cleanup
This commit is contained in:
1 parent
e02b552da3
commit
ddaceeaffe
2 files changed
+6
-9
No files matched your search
@@ -25,18 +25,22 @@ BLUE = (0, 0, 255)
|
||||
|
||||
|
||||
class Moon(Game):
|
||||
"""Demonstrates a moon orbiting the Earth using matrix rotation."""
|
||||
|
||||
def __init__(self, title: str = "Moon", fps: int = 60, size: Tuple[int, int] = (640, 400)) -> None:
|
||||
super().__init__(title, fps, size)
|
||||
# Earth centre – centre of the window
|
||||
self.center: Tuple[int, int] = (size[0] // 2, size[1] // 2)
|
||||
# Fixed orbit offset from the centre
|
||||
self.offset: Tuple[float, float] = (100.0, 0.0)
|
||||
self.offset: Tuple[float, float] = (150.0, 0.0)
|
||||
# Angular speed (radians per frame)
|
||||
self.delta_theta: float = 0.01
|
||||
self.theta: float = 0.0
|
||||
self.rot_moon: list[list[float]] = rot_2D(self.theta)
|
||||
# Initial moon position
|
||||
self.position_moon = (
|
||||
self.center[0] + self.offset[0],
|
||||
self.center[1] + self.offset[1],
|
||||
)
|
||||
|
||||
def update_game(self) -> bool:
|
||||
# Advance the angle and recompute the rotation matrix
|
||||
|
||||
Reference in new issue
Block a user