Push
This commit is contained in:
parent
0dd7e66008
commit
3f09a6d9f9
@ -4,7 +4,7 @@
|
|||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="jdk" jdkName="Python 3.9 (Arbeit1)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (TruckSimulator)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (Arbeit1)" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
10
player.py
10
player.py
@ -26,11 +26,11 @@ class Player(pygame.sprite.Sprite):
|
|||||||
if self.rect.y > self.dest_y:
|
if self.rect.y > self.dest_y:
|
||||||
self.rect.y -= self.speed
|
self.rect.y -= self.speed
|
||||||
|
|
||||||
direction = pygame.math.Vector2(self.dest_x - self.rect.centerx, self.dest_y - self.rect.centery)
|
direction = pygame.math.Vector2(self.dest_x - self.rect.centerx, self.dest_y - self.rect.centery)
|
||||||
angle = -math.degrees(math.atan2(direction.y, direction.x))
|
angle = -math.degrees(math.atan2(direction.y, direction.x))
|
||||||
self.image = pygame.transform.rotate(self.image, angle)
|
self.image = pygame.transform.rotate(self.image, angle)
|
||||||
self.rect = self.image.get_rect(center=self.rect.center)
|
self.rect = self.image.get_rect(center=self.rect.center)
|
||||||
self.direction = direction.normalize()
|
self.direction = direction.normalize()
|
||||||
|
|
||||||
def dest(self, pos):
|
def dest(self, pos):
|
||||||
self.dest_x, self.dest_y = pos
|
self.dest_x, self.dest_y = pos
|
Loading…
Reference in New Issue
Block a user