~rick-rickspencer3/pygame-template/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pygame, random
from baseSprite import BaseSprite
import crashteroidsconfig

class Enemy(BaseSprite):
 def __init__(self):
  BaseSprite.__init__(self, crashteroidsconfig.enemy_image)
  self.points = 1
  self.accelerationDivisor = 1  
  random.seed()
  self.orientation = 0
  self.rotatingRight = False
  self.rotatingLeft = False
  self.rotationRate = 0
  self.velocityX = 0
  self.velocityY = 0
  self.startPos()
      
 def startPos(self):
  #leave room in the center for the tank
  quad = random.randint(0,3)
  if quad == 0:
   self.x = random.randint(0,300)
   self.y = random.randint(0,140)
  if quad == 1:
   self.x = random.randint(500,800)
   self.y = random.randint(0,140)  
  if quad == 2:
   self.x = random.randint(0,200)
   self.y = random.randint(340,480)
  if quad == 3:
   self.x = random.randint(500,800)
   self.y = random.randint(340,480)