MoonGame/apollo.py
2025-11-04 12:40:22 +01:00

24 lines
750 B
Python

from moon import Moon
from compute import rotation_matrix, apply_mat_to_vec, add
import pygame
import math
class Apollo(Moon):
def __init__(self):
super().__init__() #Fenster
self.ship_radius = 6
self.ship_distance = self.orbit_radius + 40 # etwas weiter außen
self.ship_color = (255, 180, 0)
def draw(self, screen: pygame.Surface) -> None:
super().draw(screen)
v0 = (float(self.ship_distance), 0.0)
R = rotation_matrix(self.angle * 1.3) #geschwindigkeit
v_rot = apply_mat_to_vec(R, v0)
pos = add(self.center, v_rot)
pygame.draw.circle(screen, self.ship_color, (int(pos[0]), int(pos[1])), self.ship_radius)
if __name__ == "__main__":
Apollo().run()