Adds a score system

This commit is contained in:
William Hubbard
2023-02-04 18:56:46 -07:00
parent c356965c2d
commit 11667a1b92

View File

@@ -24,6 +24,8 @@ class GameLoop:
self.player = Player()
self.score = 0
def get_obstacle_slice(self):
return OBSTACLE_SLICES[randrange(0, len(OBSTACLE_SLICES))]
@@ -50,11 +52,14 @@ class GameLoop:
to_remove.add(entity)
self.entities -= to_remove
self.score = int(self.current_depth * 10)
thumby.display.fill(0)
# Draw the entities
for entity in self.entities:
entity.render(tpf, self.current_depth, prev_depth)
self.player.update_draw(self.current_depth, prev_depth)
thumby.display.drawText(str(self.score), thumby.display.width - (len(str(self.score)) + 2) * 5, 1, 1)
thumby.display.update()
def main():