~rick-rickspencer3/pygame-template/trunk

« back to all changes in this revision

Viewing changes to crashteroids/powerup.py

  • Committer: Rick Spencer
  • Date: 2010-02-27 17:02:38 UTC
  • Revision ID: rick.spencer@canonical.com-20100227170238-z66mz7vgy0tjwbwa
original input of crashteroids making generic game

Show diffs side-by-side

added added

removed removed

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