fix activateGhost and Frog functions, refactor & cleanup

This commit is contained in:
Xevion
2020-04-23 23:29:25 -05:00
parent f24a4c5c21
commit 6e6d4a6241

View File

@@ -4,8 +4,10 @@ Recipes are combinations of three monsters. When a player fills a recipe they ge
import arcade import arcade
from config import SpritePaths
class Recipe:
class Recipe():
''' '''
A class of different recipes A class of different recipes
''' '''
@@ -24,7 +26,7 @@ class ActiveRecipe(arcade.SpriteList):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.active = Recipe.GHOSTS self.active = Recipe.GHOSTS
self.cycle_recipes = [self.set_frogs, self.set_ghosts] self.cycle_recipes = [self.activateFrogs, self.activateGhost]
self.pos = 0 self.pos = 0
self.kill_num = 0 self.kill_num = 0
@@ -58,17 +60,16 @@ class ActiveRecipe(arcade.SpriteList):
sprite.color = (r, g, b) sprite.color = (r, g, b)
return return
def set_ghosts(self) -> None: def activateGhost(self) -> None:
"""
Make the 'Ghost' recipe the current active recipe.
"""
self.active = Recipe.GHOSTS self.active = Recipe.GHOSTS
self.sprite_list = [] self.sprite_list = [arcade.Sprite(SpritePaths.GHOST)] * 3
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"))
self.sprite_list.append(arcade.Sprite(filename="resources/images/monsters/ghost/ghost1.png"))
def activateFrogs(self) -> None:
def set_frogs(self) -> None: """
Make the 'Frogs' recipe the current active recipe.
"""
self.active = Recipe.FROGS self.active = Recipe.FROGS
self.sprite_list = [] self.sprite_list = [arcade.Sprite(SpritePaths.FROG)] * 3
self.sprite_list.append(arcade.Sprite(filename="resources/images/monsters/frog/frog1.png"))
self.sprite_list.append(arcade.Sprite(filename="resources/images/monsters/frog/frog1.png"))
self.sprite_list.append(arcade.Sprite(filename="resources/images/monsters/frog/frog1.png"))