feat: implement gravity on current piece

This commit is contained in:
2021-06-08 17:21:15 -04:00
parent b42a2c377b
commit 52cbec5a8f
3 changed files with 28 additions and 6 deletions

View File

@@ -8,9 +8,10 @@ class Entity:
self.points = points
self.color = color
self.border_color = border_color
self.elapsed_time = 0
def update(self) -> None:
pass
def update(self, elapsed_time) -> None:
self.elapsed_time += elapsed_time
def draw(self, surface: pygame.Surface) -> None:
tile_size = ConfigurationManager.configuration["engine"]["tile-size"]
@@ -20,7 +21,7 @@ class Entity:
if self.border_color:
pygame.draw.polygon(surface, pygame.Color(self.border_color), square, max(tile_size // 6, 1))
def collide(self, entity) -> bool:
def collide(self, entity) -> bool: # TODO figure out how to do type hint for entity param of type Entity
for square_one in self.points:
for square_two in entity.points:
for i in range(4): # 4 vertices