food turns green as it spoils
This commit is contained in:
parent
6952e88e61
commit
56857e24b8
2
main.py
2
main.py
@ -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:
|
||||||
|
|||||||
@ -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)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user