| 208 | |
| 209 | |
| 210 | class Enemies: |
| 211 | def __init__(self): |
| 212 | # Place the enemies at random |
| 213 | self.x = random.randint(700, 1000) |
| 214 | self.y = random.randint( |
| 215 | 0, |
| 216 | Display().windows.get_height() - Display().enemy_spaceship.get_height() + 1, |
| 217 | ) |
| 218 | # Randomly select between two types of enemies |
| 219 | self.type = random.choice([1, 2]) |
| 220 | # List for the location of the lasers/missiles |
| 221 | self.bullets_list = [] |
| 222 | self.alive = True |
| 223 | |
| 224 | def collision_box(self): |
| 225 | return pygame.Rect( |
| 226 | (self.x, self.y), |
| 227 | ( |
| 228 | Display().enemy_spaceship.get_width(), |
| 229 | Display().enemy_spaceship.get_height(), |
| 230 | ), |
| 231 | ) |
| 232 | |
| 233 | def firing(self): |
| 234 | # Append the location of lasers/missiles |
| 235 | self.bullets_list.append([self.x, self.y]) |
| 236 | |
| 237 | |
| 238 | class Objects: |
no outgoing calls
no test coverage detected