Shift key to cycle recipes

This commit is contained in:
Cameron Smart
2020-04-22 23:11:36 -07:00
parent e9c8afa758
commit 9c26aa156f
4 changed files with 19 additions and 16 deletions

View File

@@ -47,7 +47,7 @@ class Config(object):
DEBUG = False
# Monster Count to be spawned
MONSTER_COUNT = 6
MONSTER_COUNT = 10
class Enums(Enum):

View File

@@ -73,16 +73,18 @@ class Game(arcade.Window):
# Create the dungeon
self.dungeon = Dungeon(0, 3)
# Set up recipes
self.active_recipe = ActiveRecipe()
self.active_recipe.set_ghosts()
# Set up the player, specifically placing it at these coordinates.
self.player = Player(self.dungeon)
self.player.scale = 1
level = random.choice(self.dungeon.levelList)
self.player.center_x, self.player.center_y = level.center()
self.player.cur_recipe = self.active_recipe.active
# x, y = level.center()
self.active_recipe = ActiveRecipe()
self.active_recipe.set_ghosts()
# Set up monsters
for count in range(Config.MONSTER_COUNT//2):
mob = Enemy(filename="resources/images/monsters/ghost/ghost1.png", dungeon=self.dungeon)
@@ -181,6 +183,7 @@ class Game(arcade.Window):
self.close()
elif key == 65505:
self.active_recipe.next_recipe()
self.player.cur_recipe = self.active_recipe.active
def on_key_release(self, key, modifiers):
"""Called when the user releases a key. """

View File

@@ -55,15 +55,18 @@ class Player(Mob):
self.prev = Enums.IDLE
self.texture = next(self.map[self.prev])
self.kill_list = []
self.cur_recipe = ['ghost', 'ghost', 'ghost']
self.cur_recipe = None
def add_kill(self, creature):
# 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)
if self.cur_recipe.sort() == self.kill_list.sort():
print(self.kill_list)
print(self.cur_recipe)
if self.cur_recipe == self.kill_list:
print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++")
self.kill_list = []
elif len(self.kill_list) >= 3:
self.kill_list = []
def update_animation(self, delta_time: float = 1 / 60) -> None:
"""

View File

@@ -4,10 +4,8 @@ Recipes are combinations of three monsters. When a player fills a recipe they ge
import arcade
from enum import Enum
class Recipe(Enum):
class Recipe:
'''
A class of different recipes
'''
@@ -41,7 +39,6 @@ class ActiveRecipe(arcade.SpriteList):
sprite.draw()
def next_recipe(self):
self.cycle_recipes[self.pos]()
self.pos += 1
if self.pos == len(self.cycle_recipes):