Skip to content

Commit

Permalink
Merge pull request #182 from arnauddupuis/arnauddupuis/issue158
Browse files Browse the repository at this point in the history
 Make a better Inventory (issue #158)
  • Loading branch information
arnauddupuis committed Apr 3, 2022
2 parents 90821dd + 5496e56 commit d47f855
Show file tree
Hide file tree
Showing 5 changed files with 547 additions and 195 deletions.
2 changes: 1 addition & 1 deletion pygamelib/actuators.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ def next_move(self): # pragma: no cover
Example::
seeker = NPC(model=Sprites.SKULL)
seeker = NPC(model=graphics.Models.SKULL)
seeker.actuator = PathFinder(game=mygame,actuated_object=seeker)
while True:
seeker.actuator.set_destination(mygame.player.pos[0],mygame.player.pos[1])
Expand Down
4 changes: 2 additions & 2 deletions pygamelib/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,12 @@ def fg_color(self, value):
self.__fg_color.detach(self)
self.__fg_color = value
self.__fg_color.attach(self)
self.notify(self, "base.Text.fg_color:changed", value)
self.notify(self, "pygamelib.base.Text.fg_color:changed", value)
elif value is None:
if self.__fg_color is not None:
self.__fg_color.detach(self)
self.__fg_color = value
self.notify(self, "base.Text.fg_color:changed", value)
self.notify(self, "pygamelib.base.Text.fg_color:changed", value)
self.__fgcc = Fore.RESET
else:
raise PglInvalidTypeException(
Expand Down
8 changes: 5 additions & 3 deletions pygamelib/board_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ class Projectile(Movable):
fireball = Projectile(
name="fireball",
model=Utils.red_bright(black_circle),
hit_model=Sprites.EXPLOSION,
hit_model=graphics.Models.EXPLOSION,
)
fireball.set_direction(constants.RIGHT)
my_game.add_projectile(1, fireball,
Expand Down Expand Up @@ -2392,7 +2392,9 @@ class Treasure(Immovable):
Example::
money_bag = Treasure(model=Sprites.MONEY_BAG,value=100,inventory_space=2)
money_bag = Treasure(
model=graphics.Models.MONEY_BAG,value=100,inventory_space=2
)
print(f"This is a money bag {money_bag}")
player.inventory.add_item(money_bag)
print(f"The inventory value is {player.inventory.value()} and is at
Expand Down Expand Up @@ -2528,7 +2530,7 @@ class Door(GenericStructure):
Example::
door1 = Door(model=Sprites.DOOR,type='locked_door')
door1 = Door(model=graphics.Models.DOOR,type='locked_door')
"""

def __init__(self, **kwargs):
Expand Down

0 comments on commit d47f855

Please sign in to comment.