mirror of
https://github.com/n0remac/game-jam-2020.git
synced 2025-12-15 04:10:00 -06:00
added speed boon with additional recipe
This commit is contained in:
@@ -38,10 +38,11 @@ class Config(object):
|
|||||||
PLAYER_MOVEMENT_SPEED = 14
|
PLAYER_MOVEMENT_SPEED = 14
|
||||||
MONSTER_MOVEMENT_SPEED = 11
|
MONSTER_MOVEMENT_SPEED = 11
|
||||||
|
|
||||||
# Boon constants
|
# Boon and Recipe constants
|
||||||
BOON_LIST = ["heal", "harden"]
|
BOON_LIST = ["heal", "harden", "hurry"]
|
||||||
HEAL_AMOUNT = 20
|
HEAL_AMOUNT = 20
|
||||||
ARMOR_AMOUNT = 1
|
ARMOR_AMOUNT = 1
|
||||||
|
SPEED_AMOUNT = 2
|
||||||
|
|
||||||
# How many pixels to keep as a minimum margin between the characters and the edge of the screen.
|
# How many pixels to keep as a minimum margin between the characters and the edge of the screen.
|
||||||
LEFT_VIEWPORT_MARGIN = 700
|
LEFT_VIEWPORT_MARGIN = 700
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ class Game(arcade.Window):
|
|||||||
# Draw stats
|
# 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("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("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:
|
if Config.DEBUG:
|
||||||
x, y = self.player.position
|
x, y = self.player.position
|
||||||
@@ -152,16 +153,16 @@ class Game(arcade.Window):
|
|||||||
"""Called whenever a key is pressed. """
|
"""Called whenever a key is pressed. """
|
||||||
|
|
||||||
if key == arcade.key.UP or key == arcade.key.W:
|
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)
|
self.prev_keypress.append(key)
|
||||||
elif key == arcade.key.DOWN or key == arcade.key.S:
|
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)
|
self.prev_keypress.append(key)
|
||||||
elif key == arcade.key.LEFT or key == arcade.key.A:
|
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)
|
self.prev_keypress.append(key)
|
||||||
elif key == arcade.key.RIGHT or key == arcade.key.D:
|
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)
|
self.prev_keypress.append(key)
|
||||||
elif key == 65307:
|
elif key == 65307:
|
||||||
self.close()
|
self.close()
|
||||||
|
|||||||
@@ -183,10 +183,13 @@ class Player(Mob):
|
|||||||
|
|
||||||
def heal(self):
|
def heal(self):
|
||||||
self.health+=Config.HEAL_AMOUNT
|
self.health+=Config.HEAL_AMOUNT
|
||||||
|
|
||||||
def harden(self):
|
def harden(self):
|
||||||
self.armor+=Config.ARMOR_AMOUNT
|
self.armor+=Config.ARMOR_AMOUNT
|
||||||
|
|
||||||
|
def hurry(self):
|
||||||
|
self.speed+=Config.SPEED_AMOUNT
|
||||||
|
|
||||||
def update_animation(self, delta_time: float = 1 / 60) -> None:
|
def update_animation(self, delta_time: float = 1 / 60) -> None:
|
||||||
"""
|
"""
|
||||||
Updates animations for the Player.
|
Updates animations for the Player.
|
||||||
|
|||||||
@@ -24,7 +24,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.set_ghosts, self.set_frogs, self.set_ggf]
|
||||||
self.pos = 0
|
self.pos = 0
|
||||||
self.kill_num = 0
|
self.kill_num = 0
|
||||||
|
|
||||||
@@ -42,10 +42,10 @@ class ActiveRecipe(arcade.SpriteList):
|
|||||||
sprite.draw()
|
sprite.draw()
|
||||||
|
|
||||||
def next_recipe(self):
|
def next_recipe(self):
|
||||||
self.cycle_recipes[self.pos]()
|
|
||||||
self.pos += 1
|
self.pos += 1
|
||||||
if self.pos == len(self.cycle_recipes):
|
if self.pos == len(self.cycle_recipes):
|
||||||
self.pos = 0
|
self.pos = 0
|
||||||
|
self.cycle_recipes[self.pos]()
|
||||||
|
|
||||||
def add_kill(self, monster_type) -> int:
|
def add_kill(self, monster_type) -> int:
|
||||||
for sprite in self.sprite_list:
|
for sprite in self.sprite_list:
|
||||||
@@ -70,4 +70,11 @@ class ActiveRecipe(arcade.SpriteList):
|
|||||||
self.sprite_list = []
|
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"))
|
||||||
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"))
|
||||||
Reference in New Issue
Block a user