From 11667a1b92083b1202deee09712881bef3c2a20e Mon Sep 17 00:00:00 2001 From: William Hubbard <75867393+Markil3@users.noreply.github.com> Date: Sat, 4 Feb 2023 18:56:46 -0700 Subject: [PATCH] Adds a score system --- Throot.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Throot.py b/Throot.py index 36e6e7c..6b41590 100644 --- a/Throot.py +++ b/Throot.py @@ -23,6 +23,8 @@ class GameLoop: self.entities = set() self.player = Player() + + self.score = 0 def get_obstacle_slice(self): return OBSTACLE_SLICES[randrange(0, len(OBSTACLE_SLICES))] @@ -49,12 +51,15 @@ class GameLoop: if not entity.update(tpf, self.current_depth, prev_depth): 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():