optimus-l1

This commit is contained in:
2025-08-12 14:48:57 +02:00
parent 89812d3ed8
commit aa907ed80a
4 changed files with 3 additions and 8 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ class GameWindow:
if position[1] == "center": if position[1] == "center":
position = (position[0], self.target_size[1] // 2 - sprite.size[1] // 2) position = (position[0], self.target_size[1] // 2 - sprite.size[1] // 2)
sprite.position = position sprite.position = position
print(sprite.position) #print(sprite.position)
self.renderer.copy(sprite, dstrect=sprite.position) self.renderer.copy(sprite, dstrect=sprite.position)
def draw_background(self, bg_texture): def draw_background(self, bg_texture):
-1
View File
@@ -141,7 +141,6 @@ class MiceMaze(controls.KeyBindings):
self.unit_positions_before.clear() self.unit_positions_before.clear()
for unit in self.units.values(): for unit in self.units.values():
self.unit_positions.setdefault(unit.position, []).append(unit) self.unit_positions.setdefault(unit.position, []).append(unit)
self.unit_positions_before.setdefault(unit.position_before, []).append(unit)
for unit in self.units.copy().values(): for unit in self.units.copy().values():
unit.move() unit.move()
unit.collisions() unit.collisions()
-1
View File
@@ -1,3 +1,2 @@
pysdl2 pysdl2
Pillow Pillow
imgui[sdl2]
+1 -4
View File
@@ -73,13 +73,10 @@ class Rat(Unit):
if self.age < AGE_THRESHOLD: if self.age < AGE_THRESHOLD:
return return
units = [] units = []
units.extend(self.game.unit_positions.get(self.position, []))
units.extend(self.game.unit_positions.get(self.position_before, [])) units.extend(self.game.unit_positions.get(self.position_before, []))
units.extend(self.game.unit_positions_before.get(self.position, []))
units.extend(self.game.unit_positions_before.get(self.position_before, []))
for unit in units: for unit in units:
if unit.id == self.id or unit.age < AGE_THRESHOLD: if unit.id == self.id or unit.age < AGE_THRESHOLD or self.position != unit.position_before:
continue continue
x1, y1, x2, y2 = self.bbox x1, y1, x2, y2 = self.bbox
ox1, oy1, ox2, oy2 = unit.bbox ox1, oy1, ox2, oy2 = unit.bbox