Aggiungi file di configurazione per i binding dei tasti e implementa la gestione degli input nel gioco

This commit is contained in:
2024-12-27 19:03:04 +01:00
parent ccf7769979
commit 98a9e5fb8b
12 changed files with 85 additions and 56 deletions
+2 -1
View File
@@ -103,7 +103,9 @@ class Rat(Unit):
self.game.spawn_unit(Point, unit.position_before, value=score)
def draw(self):
start_perf = self.game.engine.get_perf_counter()
direction = self.calculate_rat_direction()
sex = self.sex if self.age > AGE_THRESHOLD else "BABY"
image = self.game.rat_assets[sex][direction]
image_size = self.game.engine.get_image_size(image)
@@ -117,7 +119,6 @@ class Rat(Unit):
x_pos = self.position_before[0] * self.game.cell_size + (self.game.cell_size - image_size[0]) // 2 + partial_x
y_pos = self.position_before[1] * self.game.cell_size + (self.game.cell_size - image_size[1]) // 2 + partial_y
self.game.engine.draw_image(x_pos, y_pos, image, anchor="nw", tag="unit")
self.bbox = (x_pos, y_pos, x_pos + image_size[0], y_pos + image_size[1])
#self.game.engine.draw_rectangle(self.bbox[0], self.bbox[1], self.bbox[2] - self.bbox[0], self.bbox[3] - self.bbox[1], "unit")