~rick-rickspencer3/pygame-template/trunk

« back to all changes in this revision

Viewing changes to crashteroids/mediumrock.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
import pygame, random
 
2
from rock import Rock
 
3
from smallrock import SmallRock
 
4
import crashteroidsconfig
 
5
 
 
6
class MediumRock(Rock):
 
7
 def __init__(self, x, y, game):
 
8
  self.game = game
 
9
  self.points = 20
 
10
  random.seed()
 
11
  rk = random.randint(0,2)
 
12
  Rock.__init__(self, config.medium_rock + str(rk) + ".png")
 
13
  self.x = x
 
14
  self.y = y
 
15
 
 
16
 def explode(self):
 
17
  for g in self.groups():
 
18
   for i in range(0,2):
 
19
    g.add(SmallRock(self.x, self.y, self.game))
 
20
  self.kill()
 
21
  self.game.increaseScore(self.points)