mirror of
https://github.com/n0remac/game-jam-2020.git
synced 2025-12-14 04:09:54 -06:00
fix docstrings, use Enums for Recipe class, rename recipe/kill funcs in ActiveRecipe, optimize sprite color func
This commit is contained in:
@@ -1,16 +1,17 @@
|
|||||||
'''
|
"""
|
||||||
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 config import SpritePaths
|
from config import SpritePaths
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
class Recipe():
|
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']
|
||||||
@@ -19,9 +20,9 @@ class Recipe():
|
|||||||
|
|
||||||
|
|
||||||
class ActiveRecipe(arcade.SpriteList):
|
class ActiveRecipe(arcade.SpriteList):
|
||||||
'''
|
"""
|
||||||
Keeps track of the active recipe and draws it.
|
Keeps track of the active recipe and draws it.
|
||||||
'''
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@@ -30,7 +31,6 @@ class ActiveRecipe(arcade.SpriteList):
|
|||||||
self.pos = 0
|
self.pos = 0
|
||||||
self.kill_num = 0
|
self.kill_num = 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:
|
||||||
@@ -43,21 +43,16 @@ class ActiveRecipe(arcade.SpriteList):
|
|||||||
x += 70
|
x += 70
|
||||||
sprite.draw()
|
sprite.draw()
|
||||||
|
|
||||||
def next_recipe(self):
|
def nextRecipe(self):
|
||||||
self.cycle_recipes[self.pos]()
|
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
|
||||||
|
|
||||||
def add_kill(self, monster_type):
|
def addKill(self, monster_type):
|
||||||
for sprite in self.sprite_list:
|
for sprite in self.sprite_list:
|
||||||
if monster_type in "ghost":
|
if monster_type == sprite:
|
||||||
r, g, b = sprite.color
|
sprite.color = tuple(spectrum * 0.5 for spectrum in sprite.color)
|
||||||
darken = lambda c, s: c * (1 - s)
|
|
||||||
r = darken(r, .5)
|
|
||||||
g = darken(g, .5)
|
|
||||||
b = darken(b, .5)
|
|
||||||
sprite.color = (r, g, b)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def activateGhost(self) -> None:
|
def activateGhost(self) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user