-
Notifications
You must be signed in to change notification settings - Fork 1
/
UserShip.py
48 lines (43 loc) · 1.63 KB
/
UserShip.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
39
40
41
42
43
44
45
46
47
48
from Ship import Ship
from AbstractObjects import Singleton
from kivy.vector import Vector
class UserShip(Ship, Singleton):
mass = 1000000
cooldown = {
"Bullet": 0,
}
selected_ammo = "Bullet"
weapon = "Cannon"
heat = {
# (heat value, overheat(planned), thruster down timer(planned))
"forward_t": [0, 0, 0],
"backward_t": [0, 0, 0],
"left_t": [0, 0, 0],
"right_t": [0, 0, 0],
"weapon_1": [0, 0, 0]
}
source = 'img/usership.png'
def thrust(self, direction):
if self.velocity.length() > self.max_speed:
self.velocity = self.velocity.normalize()*self.max_speed
return
if direction == "forward_t":
self.velocity = (self.velocity
+ Vector(0.1, 0).rotate(self.angle)
* self.heat[direction][0])
self.overheat(direction)
elif direction == "backward_t":
self.velocity = (self.velocity
+ Vector(0.05, 0).rotate(self.angle + 180)
* self.heat[direction][0])
self.overheat(direction)
elif direction == "left_t":
self.velocity = (self.velocity
+ Vector(0.03, 0).rotate(self.angle + 90)
* self.heat[direction][0])
self.overheat(direction)
elif direction == "right_t":
self.velocity = (self.velocity
+ Vector(0.03, 0).rotate(self.angle + 270)
* self.heat[direction][0])
self.overheat(direction)