1
by Rick Spencer
original input of crashteroids making generic game |
1 |
import pygame, random |
2 |
from baseSprite import BaseSprite |
|
2
by Rick Spencer
have removed extraneous crashteroids stuff |
3 |
import crashteroidsconfig |
1
by Rick Spencer
original input of crashteroids making generic game |
4 |
|
2
by Rick Spencer
have removed extraneous crashteroids stuff |
5 |
class Enemy(BaseSprite): |
6 |
def __init__(self): |
|
7 |
BaseSprite.__init__(self, crashteroidsconfig.enemy_image) |
|
8 |
self.points = 1 |
|
9 |
self.accelerationDivisor = 1 |
|
1
by Rick Spencer
original input of crashteroids making generic game |
10 |
random.seed() |
2
by Rick Spencer
have removed extraneous crashteroids stuff |
11 |
self.orientation = 0 |
12 |
self.rotatingRight = False |
|
13 |
self.rotatingLeft = False |
|
14 |
self.rotationRate = 0 |
|
15 |
self.velocityX = 0 |
|
16 |
self.velocityY = 0 |
|
17 |
self.startPos() |
|
1
by Rick Spencer
original input of crashteroids making generic game |
18 |
|
19 |
def startPos(self): |
|
20 |
#leave room in the center for the tank
|
|
21 |
quad = random.randint(0,3) |
|
22 |
if quad == 0: |
|
23 |
self.x = random.randint(0,300) |
|
24 |
self.y = random.randint(0,140) |
|
25 |
if quad == 1: |
|
26 |
self.x = random.randint(500,800) |
|
27 |
self.y = random.randint(0,140) |
|
28 |
if quad == 2: |
|
29 |
self.x = random.randint(0,200) |
|
30 |
self.y = random.randint(340,480) |
|
31 |
if quad == 3: |
|
32 |
self.x = random.randint(500,800) |
|
33 |
self.y = random.randint(340,480) |
|
34 |