food turns green as it spoils

This commit is contained in:
Bnenne 2025-06-02 00:30:51 -05:00
parent 6952e88e61
commit 56857e24b8
2 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ GRID_WIDTH = 20 # Number of cells horizontally
GRID_HEIGHT = 15 # Number of cells vertically GRID_HEIGHT = 15 # Number of cells vertically
CELL_SIZE = 20 # Size of each cell in pixels CELL_SIZE = 20 # Size of each cell in pixels
DEFAULT_TPS = 200 # Amount of ticks per second for the simulation DEFAULT_TPS = 20 # Amount of ticks per second for the simulation
class Camera: class Camera:

View File

@ -21,10 +21,10 @@ class FoodObject:
def tick(self): def tick(self):
self.decay += 1 self.decay += 1
if (self.decay > 255): if self.decay > 255:
self.decay = 0 self.decay = 0
def render(self, camera, screen): def render(self, camera, screen):
if camera.is_in_view(*self.position.get_position()): if camera.is_in_view(*self.position.get_position()):
pygame.draw.circle(screen, (255,self.decay,0), camera.world_to_screen(*self.position.get_position()), 5 * camera.zoom) pygame.draw.circle(screen, (255-self.decay,self.decay,0), camera.world_to_screen(*self.position.get_position()), 5 * camera.zoom)