29 lines
871 B
Python
29 lines
871 B
Python
import pygame
|
|
|
|
from game.game import Game
|
|
from numeric.compute import rot_2D, matmul
|
|
|
|
|
|
class Moon(Game):
|
|
def __init__(self):
|
|
super().__init__("Moon")
|
|
self.moon_position = None
|
|
self.center = (540, 355)
|
|
self.moon_distance = [[200], [0]]
|
|
self.angle = 0
|
|
|
|
def update_game(self):
|
|
self.angle = pygame.time.get_ticks() / 1000 # Zeit = Winkel
|
|
rot = rot_2D(self.angle)
|
|
rotated = matmul(rot, self.moon_distance)
|
|
self.moon_position = (
|
|
int(self.center[0] + rotated[0][0]),
|
|
int(self.center[1] + rotated[1][0])
|
|
)
|
|
return True
|
|
|
|
def draw_game(self):
|
|
self.screen.fill((30,30,30))
|
|
pygame.draw.circle(self.screen, (0,0,255), self.center, 12)
|
|
pygame.draw.circle(self.screen, (255,255,255), self.moon_position, 8)
|
|
pygame.display.flip() |