optimus-l1
This commit is contained in:
+1
-1
@@ -92,7 +92,7 @@ class GameWindow:
|
||||
if position[1] == "center":
|
||||
position = (position[0], self.target_size[1] // 2 - sprite.size[1] // 2)
|
||||
sprite.position = position
|
||||
print(sprite.position)
|
||||
#print(sprite.position)
|
||||
self.renderer.copy(sprite, dstrect=sprite.position)
|
||||
|
||||
def draw_background(self, bg_texture):
|
||||
|
||||
@@ -141,7 +141,6 @@ class MiceMaze(controls.KeyBindings):
|
||||
self.unit_positions_before.clear()
|
||||
for unit in self.units.values():
|
||||
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():
|
||||
unit.move()
|
||||
unit.collisions()
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
pysdl2
|
||||
Pillow
|
||||
imgui[sdl2]
|
||||
+1
-4
@@ -73,13 +73,10 @@ class Rat(Unit):
|
||||
if self.age < AGE_THRESHOLD:
|
||||
return
|
||||
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_before.get(self.position, []))
|
||||
units.extend(self.game.unit_positions_before.get(self.position_before, []))
|
||||
|
||||
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
|
||||
x1, y1, x2, y2 = self.bbox
|
||||
ox1, oy1, ox2, oy2 = unit.bbox
|
||||
|
||||
Reference in New Issue
Block a user