added speed boon with additional recipe

This commit is contained in:
Lief9100
2020-04-24 18:11:07 -07:00
parent 061d688701
commit 5642174af5
4 changed files with 22 additions and 10 deletions

View File

@@ -38,10 +38,11 @@ class Config(object):
PLAYER_MOVEMENT_SPEED = 14
MONSTER_MOVEMENT_SPEED = 11
# Boon constants
BOON_LIST = ["heal", "harden"]
# Boon and Recipe constants
BOON_LIST = ["heal", "harden", "hurry"]
HEAL_AMOUNT = 20
ARMOR_AMOUNT = 1
SPEED_AMOUNT = 2
# How many pixels to keep as a minimum margin between the characters and the edge of the screen.
LEFT_VIEWPORT_MARGIN = 700

View File

@@ -109,6 +109,7 @@ class Game(arcade.Window):
# Draw stats
arcade.draw_text("Health:"+str(self.player.health)+"/"+str(self.player.max_health), self.view_left+100, self.view_bottom+60, arcade.color.RED, 15, font_name='Arial')
arcade.draw_text("Armor:"+str(self.player.armor), self.view_left+100, self.view_bottom+90, arcade.color.BLUE, 15, font_name='Arial')
arcade.draw_text("Speed:"+str(self.player.speed), self.view_left+100, self.view_bottom+120, arcade.color.YELLOW, 15, font_name='Arial')
if Config.DEBUG:
x, y = self.player.position
@@ -152,16 +153,16 @@ class Game(arcade.Window):
"""Called whenever a key is pressed. """
if key == arcade.key.UP or key == arcade.key.W:
self.player.change_y = Config.PLAYER_MOVEMENT_SPEED
self.player.change_y = self.player.speed
self.prev_keypress.append(key)
elif key == arcade.key.DOWN or key == arcade.key.S:
self.player.change_y = -Config.PLAYER_MOVEMENT_SPEED
self.player.change_y = -self.player.speed
self.prev_keypress.append(key)
elif key == arcade.key.LEFT or key == arcade.key.A:
self.player.change_x = -Config.PLAYER_MOVEMENT_SPEED
self.player.change_x = -self.player.speed
self.prev_keypress.append(key)
elif key == arcade.key.RIGHT or key == arcade.key.D:
self.player.change_x = Config.PLAYER_MOVEMENT_SPEED
self.player.change_x = self.player.speed
self.prev_keypress.append(key)
elif key == 65307:
self.close()

View File

@@ -183,10 +183,13 @@ class Player(Mob):
def heal(self):
self.health+=Config.HEAL_AMOUNT
def harden(self):
self.armor+=Config.ARMOR_AMOUNT
def hurry(self):
self.speed+=Config.SPEED_AMOUNT
def update_animation(self, delta_time: float = 1 / 60) -> None:
"""
Updates animations for the Player.

View File

@@ -24,7 +24,7 @@ class ActiveRecipe(arcade.SpriteList):
def __init__(self):
super().__init__()
self.active = Recipe.GHOSTS
self.cycle_recipes = [self.set_frogs, self.set_ghosts]
self.cycle_recipes = [self.set_ghosts, self.set_frogs, self.set_ggf]
self.pos = 0
self.kill_num = 0
@@ -42,10 +42,10 @@ 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):
self.pos = 0
self.cycle_recipes[self.pos]()
def add_kill(self, monster_type) -> int:
for sprite in self.sprite_list:
@@ -70,4 +70,11 @@ class ActiveRecipe(arcade.SpriteList):
self.sprite_list = []
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"))
self.sprite_list.append(arcade.Sprite(filename="resources/images/monsters/frog/frog1.png"))
def set_ggf(self) -> None:
self.active = Recipe.GHOST_FROG
self.sprite_list = []
self.sprite_list.append(arcade.Sprite(filename="resources/images/monsters/frog/frog1.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"))