~rick-rickspencer3/pygame-template/trunk

« back to all changes in this revision

Viewing changes to crashteroids/homingmissle.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 homingrock import HomingRock
 
3
from bullet import Bullet
 
4
import crashteroidsconfig
 
5
 
 
6
class HomingMissle(HomingRock):
 
7
 def __init__(self, player, difficulty = 1):
 
8
  if difficulty < 3:
 
9
   HomingRock.__init__(self, player, config.big_missle_img)
 
10
  else:
 
11
   HomingRock.__init__(self, player, config.small_missle_img)
 
12
  self.player = player
 
13
  self.visible = True
 
14
  self.startPos()
 
15
  self.points = 200  
 
16
  self.setDifficulty(difficulty)
 
17
 
 
18
 def setDifficulty(self, diff):
 
19
  self.difficulty = diff
 
20
  if diff == 1:
 
21
   self.rotationRate = 5
 
22
   self.maxVelocity = 10
 
23
  if diff == 2:
 
24
   self.rotationRate = 5
 
25
   self.maxVelocity = 10
 
26
  if diff == 3:
 
27
   self.rotationRate = 10
 
28
   self.maxVelocity = 10
 
29
  if diff == 4:
 
30
   self.rotationRate = 15
 
31
   self.maxVelocity = 10
 
32
  else:
 
33
   self.rotationRate = 15
 
34
   self.maxVelocity = 12
 
35
 
 
36
 def update(self):
 
37
  HomingRock.update(self)