update
This commit is contained in:
parent
442d5f14c6
commit
73efb26db2
@ -5,11 +5,12 @@ import math
|
|||||||
def get_angle(p1, p2):
|
def get_angle(p1, p2):
|
||||||
dx = p2[0] - p1[0]
|
dx = p2[0] - p1[0]
|
||||||
dy = p2[1] - p1[1]
|
dy = p2[1] - p1[1]
|
||||||
rads = math.atan2(-dy,dx)
|
rads = math.atan2(-dy, dx)
|
||||||
rads %= 2*math.pi
|
rads %= 2 * math.pi
|
||||||
degs = math.degrees(rads)
|
degs = math.degrees(rads)
|
||||||
return degs
|
return degs
|
||||||
|
|
||||||
|
|
||||||
class Fahrzeug(pygame.sprite.Sprite):
|
class Fahrzeug(pygame.sprite.Sprite):
|
||||||
def __init__(self, x, y):
|
def __init__(self, x, y):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@ -26,11 +27,10 @@ class Fahrzeug(pygame.sprite.Sprite):
|
|||||||
if self.rect.centerx != self.dest_x or self.rect.centery != self.dest_y:
|
if self.rect.centerx != self.dest_x or self.rect.centery != self.dest_y:
|
||||||
if self.Tank > 0:
|
if self.Tank > 0:
|
||||||
self.Tank -= 0.1
|
self.Tank -= 0.1
|
||||||
self.angle = get_angle((self.rect.centerx, self.rect.centery), (self.dest_x, self.dest_y))-90
|
self.angle = get_angle((self.rect.centerx, self.rect.centery), (self.dest_x, self.dest_y)) - 90
|
||||||
|
|
||||||
def move(self):
|
def move(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def dest(self, pos):
|
def dest(self, pos):
|
||||||
self.dest_x, self.dest_y = pos
|
self.dest_x, self.dest_y = pos
|
||||||
|
|
||||||
|
@ -24,3 +24,4 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user