1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
from rock import Rock import random class PowerUp(Rock): def __init__(self, game, img): self.game = game Rock.__init__(self, img) self.startPos() self.ticks = 0 self.life_span = random.randint(100,1000) def update(self): Rock.update(self) self.ticks += 1 if self.ticks > self.life_span: self.kill() def explode(self): self.kill() |