Return to repo list

gatemender

Arcade game about fixing warp gates. LibreJam Dec 2020 Entry.
Return to HMagellan.com

commit 38d0d33ab4061a0517897f8208a065a882119288
parent 89816285644b517799a60b3ebae127ec51562cf0
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Mon, 14 Dec 2020 17:38:31 -0600

Pickups now disappear after a while

Diffstat:
Msrc/sprites.py | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/sprites.py b/src/sprites.py @@ -348,9 +348,19 @@ class Pickup(CustomSprite): def __init__(self, manager, image, pos, angle = 0, material = MATERIALS.Alpha): super().__init__(manager, image, pos, angle) self.material = material + self.lifetime = 1000 // max(1, self.manager.level_factor // 2) def act(self): self.rotate(self.angle + 1) + if self.lifetime > 0: + self.lifetime -= 1 + if self.lifetime < 180: + if self.lifetime % 2 == 0 or self.lifetime % 3 == 0: + self.visible = False + else: + self.visible = True + else: + self.kill() if self.rect.colliderect(self.manager.ship.rect): self.manager.ship.materials[self.material] += 1 self.kill()