added boon functions and returns from kill funcitons

This commit is contained in:
Lief9100
2020-04-24 16:47:58 -07:00
parent 9de313f440
commit 9da3faac8f
2 changed files with 17 additions and 12 deletions

View File

@@ -130,7 +130,7 @@ class Mob(arcade.Sprite):
super(Mob, self).__init__(*args, **kwargs)
self.max_health, self.max_armor = max_health, max_armor
self.health, self.armor = max_health, max_armor
self.health, self.armor = 60, max_armor
self.idle_textures = []
self.walking_textures = []
self.up_textures = []
@@ -168,16 +168,24 @@ class Player(Mob):
self.cur_recipe = None
self.speed = 14
def add_kill(self, creature):
def add_kill(self, creature) -> int:
# Adds a kill to kill_list. If 3 or more check the recipe then give a power up if it matches.
self.kill_list.append(creature)
print(self.kill_list)
print(self.cur_recipe)
if len(self.kill_list) >= 3:
if self.cur_recipe == self.kill_list:
print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++")
self.kill_list = []
elif len(self.kill_list) >= 3:
return 1
self.kill_list = []
return 0
def heal(self):
self.health+=Config.HEAL_AMOUNT
def harden(self):
self.armor+=Config.ARMOR_AMOUNT
def update_animation(self, delta_time: float = 1 / 60) -> None:
"""
@@ -258,8 +266,6 @@ class Enemy(Mob):
else:
self.change_y = 0
def get_path(self, end: Tuple[int, int] = None) -> List[Tuple[int, int]]:
"""
Returns the path to get to the Mob's target in absolute integer positions.

View File

@@ -47,7 +47,7 @@ class ActiveRecipe(arcade.SpriteList):
if self.pos == len(self.cycle_recipes):
self.pos = 0
def add_kill(self, monster_type):
def add_kill(self, monster_type) -> int:
for sprite in self.sprite_list:
if monster_type in "ghost":
r, g, b = sprite.color
@@ -56,7 +56,7 @@ class ActiveRecipe(arcade.SpriteList):
g = darken(g, .5)
b = darken(b, .5)
sprite.color = (r, g, b)
return
return self.pos
def set_ghosts(self) -> None:
self.active = Recipe.GHOSTS
@@ -65,7 +65,6 @@ class ActiveRecipe(arcade.SpriteList):
self.sprite_list.append(arcade.Sprite(filename="resources/images/monsters/ghost/ghost1.png"))
self.sprite_list.append(arcade.Sprite(filename="resources/images/monsters/ghost/ghost1.png"))
def set_frogs(self) -> None:
self.active = Recipe.FROGS
self.sprite_list = []