mirror of
https://github.com/n0remac/game-jam-2020.git
synced 2025-12-07 03:13:15 -06:00
Added frogs. Linting.
This commit is contained in:
@@ -47,7 +47,7 @@ class Config(object):
|
|||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
# Monster Count to be spawned
|
# Monster Count to be spawned
|
||||||
MONSTER_COUNT = 0
|
MONSTER_COUNT = 6
|
||||||
|
|
||||||
|
|
||||||
class Enums(Enum):
|
class Enums(Enum):
|
||||||
|
|||||||
@@ -84,13 +84,20 @@ class Game(arcade.Window):
|
|||||||
self.active_recipe.set_ghosts()
|
self.active_recipe.set_ghosts()
|
||||||
|
|
||||||
# Set up monsters
|
# Set up monsters
|
||||||
for count in range(Config.MONSTER_COUNT):
|
for count in range(Config.MONSTER_COUNT//2):
|
||||||
mob = Enemy(filename="resources/images/monsters/ghost/ghost1.png", dungeon=self.dungeon)
|
mob = Enemy(filename="resources/images/monsters/ghost/ghost1.png", dungeon=self.dungeon)
|
||||||
mob.center_x, mob.center_y = random.choice(self.dungeon.levelList).center()
|
mob.center_x, mob.center_y = random.choice(self.dungeon.levelList).center()
|
||||||
mob.target = self.player
|
mob.target = self.player
|
||||||
mob.scale = 4
|
mob.scale = 4
|
||||||
mob.monster_type = 'ghost'
|
mob.monster_type = 'ghost'
|
||||||
self.enemy_list.append(mob)
|
self.enemy_list.append(mob)
|
||||||
|
for count in range(Config.MONSTER_COUNT//2):
|
||||||
|
mob = Enemy(filename="resources/images/monsters/frog/frog1.png", dungeon=self.dungeon)
|
||||||
|
mob.center_x, mob.center_y = random.choice(self.dungeon.levelList).center()
|
||||||
|
mob.target = self.player
|
||||||
|
mob.scale = 4
|
||||||
|
mob.monster_type = 'frog'
|
||||||
|
self.enemy_list.append(mob)
|
||||||
|
|
||||||
# Setup viewport
|
# Setup viewport
|
||||||
self.view_bottom = self.player.center_x - (0.5 * Config.SCREEN_WIDTH) + 300
|
self.view_bottom = self.player.center_x - (0.5 * Config.SCREEN_WIDTH) + 300
|
||||||
@@ -122,10 +129,10 @@ class Game(arcade.Window):
|
|||||||
arcade.draw_rectangle_outline(round(x / Config.TILE_SIZE) * Config.TILE_SIZE,
|
arcade.draw_rectangle_outline(round(x / Config.TILE_SIZE) * Config.TILE_SIZE,
|
||||||
round(y / Config.TILE_SIZE) * Config.TILE_SIZE,
|
round(y / Config.TILE_SIZE) * Config.TILE_SIZE,
|
||||||
Config.TILE_SIZE, Config.TILE_SIZE, arcade.color.RED)
|
Config.TILE_SIZE, Config.TILE_SIZE, arcade.color.RED)
|
||||||
#self.player.draw_hit_box()
|
self.player.draw_hit_box()
|
||||||
#arcade.draw_text(str((x, y)), x - 40, y + 50, arcade.color.WHITE, 15, font_name='Arial')
|
arcade.draw_text(str((x, y)), x - 40, y + 50, arcade.color.WHITE, 15, font_name='Arial')
|
||||||
#arcade.draw_text(f"FPS: {self.fps.get_fps():3.0f}", self.view_left + 50, self.view_bottom + 30,
|
arcade.draw_text(f"FPS: {self.fps.get_fps():3.0f}", self.view_left + 50, self.view_bottom + 30,
|
||||||
# arcade.color.WHITE, 16, font_name='Arial')
|
arcade.color.WHITE, 16, font_name='Arial')
|
||||||
|
|
||||||
# Draw paths for all mobs
|
# Draw paths for all mobs
|
||||||
for mob in self.active_enemies:
|
for mob in self.active_enemies:
|
||||||
@@ -133,8 +140,8 @@ class Game(arcade.Window):
|
|||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
path = mob.get_path()
|
path = mob.get_path()
|
||||||
t2 = time.time()
|
t2 = time.time()
|
||||||
#print(f'Path acquired in {round(t2 - t1, 4)}s')
|
print(f'Path acquired in {round(t2 - t1, 4)}s')
|
||||||
#self.draw_path(path)
|
self.draw_path(path)
|
||||||
mob.tick(path)
|
mob.tick(path)
|
||||||
|
|
||||||
self.fps.tick()
|
self.fps.tick()
|
||||||
@@ -279,7 +286,8 @@ class Game(arcade.Window):
|
|||||||
enemy.right < self.view_left + Config.SCREEN_WIDTH and
|
enemy.right < self.view_left + Config.SCREEN_WIDTH and
|
||||||
enemy.left > self.view_left
|
enemy.left > self.view_left
|
||||||
):
|
):
|
||||||
if Config.DEBUG: print("Activate Enemy")
|
if Config.DEBUG:
|
||||||
|
print("Activate Enemy")
|
||||||
self.active_enemies.append(enemy)
|
self.active_enemies.append(enemy)
|
||||||
self.enemy_list.remove(enemy)
|
self.enemy_list.remove(enemy)
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ class Mob(arcade.Sprite):
|
|||||||
self.target = None
|
self.target = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Player(Mob):
|
class Player(Mob):
|
||||||
"""
|
"""
|
||||||
Represents a Player.
|
Represents a Player.
|
||||||
@@ -67,7 +65,6 @@ class Player(Mob):
|
|||||||
print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++")
|
print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++")
|
||||||
self.kill_list = []
|
self.kill_list = []
|
||||||
|
|
||||||
|
|
||||||
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.
|
||||||
@@ -161,4 +158,3 @@ class Enemy(Mob):
|
|||||||
paths, runs = self.dungeon.finder.find_path(start, end, self.dungeon.grid)
|
paths, runs = self.dungeon.finder.find_path(start, end, self.dungeon.grid)
|
||||||
self.dungeon.grid.cleanup()
|
self.dungeon.grid.cleanup()
|
||||||
return paths
|
return paths
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
'''
|
'''
|
||||||
Recipes are combinations of three monsters. When a player fills a recipe they get an updgrade
|
Recipes are combinations of three monsters. When a player fills a recipe they get an updgrade
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import arcade
|
import arcade
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
class Recipe(Enum):
|
class Recipe(Enum):
|
||||||
'''A class of different recipes'''
|
'''
|
||||||
|
A class of different recipes
|
||||||
|
'''
|
||||||
|
|
||||||
GHOSTS = ['ghost', 'ghost', 'ghost']
|
GHOSTS = ['ghost', 'ghost', 'ghost']
|
||||||
FROGS = ['frog', 'frog', 'frog']
|
FROGS = ['frog', 'frog', 'frog']
|
||||||
@@ -26,7 +29,6 @@ class ActiveRecipe(arcade.SpriteList):
|
|||||||
self.cycle_recipes = [self.set_frogs, self.set_ghosts]
|
self.cycle_recipes = [self.set_frogs, self.set_ghosts]
|
||||||
self.pos = 0
|
self.pos = 0
|
||||||
|
|
||||||
|
|
||||||
def render(self) -> None:
|
def render(self) -> None:
|
||||||
x = 0
|
x = 0
|
||||||
for sprite in self.sprite_list:
|
for sprite in self.sprite_list:
|
||||||
|
|||||||
Reference in New Issue
Block a user