|
|
@@ -25,6 +25,14 @@ from youtube import * |
|
|
|
|
|
|
|
|
|
|
|
class Main: |
|
|
|
kita_x: float = CWindow.WIDTH / 2 |
|
|
|
kita_y: float = 1000000. |
|
|
|
kita_arg: float = 0. |
|
|
|
|
|
|
|
jojoko_x: float = CWindow.WIDTH / 2 |
|
|
|
jojoko_y: float = 1000000. |
|
|
|
jojoko_arg: float = 0. |
|
|
|
|
|
|
|
@classmethod |
|
|
|
def main ( |
|
|
|
cls, |
|
|
@@ -331,7 +339,7 @@ class Main: |
|
|
|
bg_evening: pygame.Surface, |
|
|
|
bg_night: pygame.Surface, |
|
|
|
bg_grass: pygame.Surface, |
|
|
|
kita: pygame.Surface, |
|
|
|
kita_original: pygame.Surface, |
|
|
|
jojoko_original: pygame.Surface, |
|
|
|
sunrise_start: datetime, |
|
|
|
sunrise_end: datetime, |
|
|
@@ -349,7 +357,19 @@ class Main: |
|
|
|
sunset_start + (sunset_end - sunset_start) / 2) |
|
|
|
|
|
|
|
jojoko: pygame.Surface = cls.get_jojoko (jojoko_original, |
|
|
|
moon_days_old, moon_alt) |
|
|
|
moon_days_old, moon_alt, moon_az) |
|
|
|
|
|
|
|
x = CWindow.WIDTH * (sun_az - 80) / 120 |
|
|
|
y = ((CWindow.HEIGHT / 2) |
|
|
|
- (CWindow.HEIGHT / 2 + 100) * math.sin (math.radians (sun_alt)) / math.sin ( math.radians (60))) |
|
|
|
arg = math.degrees (math.atan2 (y - cls.kita_y, x - cls.kita_x)) |
|
|
|
|
|
|
|
cls.kita_x = x |
|
|
|
cls.kita_y = y |
|
|
|
if abs (arg - cls.kita_arg) > 3: |
|
|
|
cls.kita_arg = arg |
|
|
|
|
|
|
|
kita: pygame.Surface = pygame.transform.rotate (kita_original, -(90 + cls.kita_arg)) |
|
|
|
|
|
|
|
dt: datetime = datetime.now () |
|
|
|
|
|
|
@@ -374,27 +394,25 @@ class Main: |
|
|
|
|
|
|
|
screen.blit (bg_evening, (0, 0)) |
|
|
|
|
|
|
|
if (moon_az < 180) and (-10 <= moon_alt < 40): |
|
|
|
y = ((CWindow.HEIGHT / 2 + 100) |
|
|
|
- (CWindow.HEIGHT / 2 + 200) / 30 * moon_alt) |
|
|
|
screen.blit (jojoko, jojoko.get_rect (center = (400, y))) |
|
|
|
if (moon_az < 220) and (-10 <= moon_alt): |
|
|
|
screen.blit (jojoko, jojoko.get_rect (center = (cls.jojoko_x, cls.jojoko_y))) |
|
|
|
|
|
|
|
screen.blit (bg_grass, (0, 0)) |
|
|
|
|
|
|
|
if (sun_az < 180) and (-10 <= sun_alt < 40): |
|
|
|
y = ((CWindow.HEIGHT / 2 + 100) |
|
|
|
- (CWindow.HEIGHT / 2 + 200) / 30 * sun_alt) |
|
|
|
screen.blit (kita, kita.get_rect (center = (400, y))) |
|
|
|
if (sun_az < 220) and (-10 <= sun_alt): |
|
|
|
screen.blit (kita, kita.get_rect (center = (cls.kita_x, cls.kita_y))) |
|
|
|
|
|
|
|
screen.blit (bg_grass, (0, 0)) |
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@classmethod |
|
|
|
def get_jojoko ( |
|
|
|
cls, |
|
|
|
jojoko_original: pygame.Surface, |
|
|
|
moon_days_old: float, |
|
|
|
moon_alt: float) \ |
|
|
|
moon_alt: float, |
|
|
|
moon_az: float) \ |
|
|
|
-> pygame.Surface: |
|
|
|
jojoko: pygame.Surface = pygame.transform.rotate (jojoko_original, -moon_alt) |
|
|
|
jojoko: pygame.Surface = jojoko_original.copy () |
|
|
|
|
|
|
|
jojoko.set_colorkey ((0, 255, 0)) |
|
|
|
|
|
|
@@ -408,7 +426,17 @@ class Main: |
|
|
|
else: |
|
|
|
jojoko.fill ((0, 255, 0)) |
|
|
|
|
|
|
|
return jojoko |
|
|
|
x = CWindow.WIDTH * (moon_az - 80) / 120 |
|
|
|
y = ((CWindow.HEIGHT / 2) |
|
|
|
- (CWindow.HEIGHT / 2 + 100) * math.sin (math.radians (moon_alt)) / math.sin (math.radians (60))) |
|
|
|
arg = math.degrees (math.atan2 (y - cls.jojoko_y, x - cls.jojoko_x)) |
|
|
|
|
|
|
|
cls.jojoko_x = x |
|
|
|
cls.jojoko_y = y |
|
|
|
if abs (arg - cls.jojoko_arg) > 3: |
|
|
|
cls.jojoko_arg = arg |
|
|
|
|
|
|
|
return pygame.transform.rotate (jojoko, -(90 + cls.jojoko_arg)) |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|