-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmedium_asteroid.py
38 lines (33 loc) · 1.23 KB
/
medium_asteroid.py
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
35
36
37
38
from asteroid import Asteroid
from globals import *
import arcade
class Medium_Asteroid(Asteroid):
"""
Tracks a Medium Asteroid. Simply
"""
def __init__(self, asteroid, direction):
super().__init__()
self.sprite = arcade.Sprite("sprites/medium_rock.png")
self.radius = MEDIUM_ROCK_RADIUS
self.sprite.angle = self.angle.angle
self.center.x = asteroid.center.x
self.center.y = asteroid.center.y
#Might have wanted to make these a different list, but I already had the
#code written when the idea was brought up, and I wanted to add extra features.
if direction == "up":
self.velocity.dy = asteroid.velocity.dy + 2
else:
self.velocity.dy = asteroid.velocity.dy - 2
self.velocity.dx = asteroid.velocity.dx
def draw(self):
self.sprite.center_x = self.center.x
self.sprite.center_y = self.center.y
self.sprite.angle += MEDIUM_ROCK_SPIN
self.sprite.update()
self.sprite.draw()
def advance(self):
self.center.x += self.velocity.dx
self.center.y += self.velocity.dy
def hit(self):
self.alive = False
return "medium"