This commit is contained in:
Faruk Acar 2023-03-27 09:29:39 +02:00
parent 0dd7e66008
commit 3f09a6d9f9
3 changed files with 7 additions and 7 deletions

View File

@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="Python 3.9 (Arbeit1)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

View File

@ -26,11 +26,11 @@ class Player(pygame.sprite.Sprite):
if self.rect.y > self.dest_y:
self.rect.y -= self.speed
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))
self.image = pygame.transform.rotate(self.image, angle)
self.rect = self.image.get_rect(center=self.rect.center)
self.direction = direction.normalize()
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))
self.image = pygame.transform.rotate(self.image, angle)
self.rect = self.image.get_rect(center=self.rect.center)
self.direction = direction.normalize()
def dest(self, pos):
self.dest_x, self.dest_y = pos