軽量化
このコミットが含まれているのは:
@@ -37,9 +37,9 @@ pygame.init ()
|
|||||||
|
|
||||||
FPS = 30
|
FPS = 30
|
||||||
|
|
||||||
SYSTEM_FONT = pygame.font.SysFont ('notosanscjkjp', 24, bold = True)
|
SYSTEM_FONT = pygame.font.SysFont ('notosanscjkjp', 11, bold = True)
|
||||||
USER_FONT = pygame.font.SysFont ('notosanscjkjp', 32, italic = True)
|
USER_FONT = pygame.font.SysFont ('notosanscjkjp', 15, italic = True)
|
||||||
DEERJIKA_FONT = pygame.font.SysFont ('07nikumarufont', 50)
|
DEERJIKA_FONT = pygame.font.SysFont ('07nikumarufont', 23)
|
||||||
|
|
||||||
|
|
||||||
def main (
|
def main (
|
||||||
@@ -49,10 +49,10 @@ def main (
|
|||||||
balloon = Balloon (game)
|
balloon = Balloon (game)
|
||||||
deerjika = Deerjika (game, DeerjikaPattern.RELAXED,
|
deerjika = Deerjika (game, DeerjikaPattern.RELAXED,
|
||||||
x = CWindow.WIDTH * 3 / 4,
|
x = CWindow.WIDTH * 3 / 4,
|
||||||
y = CWindow.HEIGHT - 120,
|
y = CWindow.HEIGHT - 56.25,
|
||||||
balloon = balloon)
|
balloon = balloon)
|
||||||
snack_time = SnackTime (game)
|
snack_time = SnackTime (game)
|
||||||
CurrentTime (game, SYSTEM_FONT)
|
CurrentTime (game, DEERJIKA_FONT)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
broadcast = Broadcast (os.environ['BROADCAST_CODE'])
|
broadcast = Broadcast (os.environ['BROADCAST_CODE'])
|
||||||
@@ -404,7 +404,7 @@ class Deerjika (Creature):
|
|||||||
FPS = 30
|
FPS = 30
|
||||||
|
|
||||||
height: int
|
height: int
|
||||||
scale: float = .8
|
scale: float = .375
|
||||||
surfaces: list[Surface]
|
surfaces: list[Surface]
|
||||||
width: int
|
width: int
|
||||||
talking: bool = False
|
talking: bool = False
|
||||||
@@ -572,22 +572,22 @@ class Balloon (GameObject):
|
|||||||
query = self.query
|
query = self.query
|
||||||
if CommonModule.len_by_full (query) > 21:
|
if CommonModule.len_by_full (query) > 21:
|
||||||
query = CommonModule.mid_by_full (query, 0, 19.5) + '...'
|
query = CommonModule.mid_by_full (query, 0, 19.5) + '...'
|
||||||
answer = Surface ((800, ((CommonModule.len_by_full (self.answer) - 1) // 16 + 1) * 50),
|
answer = Surface ((375, ((CommonModule.len_by_full (self.answer) - 1) // 16 + 1) * 23.4375),
|
||||||
pygame.SRCALPHA)
|
pygame.SRCALPHA)
|
||||||
for i in range (int (CommonModule.len_by_full (self.answer) - 1) // 16 + 1):
|
for i in range (int (CommonModule.len_by_full (self.answer) - 1) // 16 + 1):
|
||||||
answer.blit (DEERJIKA_FONT.render (
|
answer.blit (DEERJIKA_FONT.render (
|
||||||
CommonModule.mid_by_full (self.answer, 16 * i, 16), True, (192, 0, 0)),
|
CommonModule.mid_by_full (self.answer, 16 * i, 16), True, (192, 0, 0)),
|
||||||
(0, 50 * i))
|
(0, 23.4375 * i))
|
||||||
surface = self.surface.copy ()
|
surface = self.surface.copy ()
|
||||||
surface.blit (USER_FONT.render ('>' + query, True, (0, 0, 0)), (120, 70))
|
surface.blit (USER_FONT.render ('>' + query, True, (0, 0, 0)), (56.25, 32.8125))
|
||||||
y: int
|
y: float
|
||||||
if self.frame < 30:
|
if self.frame < 30:
|
||||||
y = 0
|
y = 0
|
||||||
elif self.frame >= self.length - 90:
|
elif self.frame >= self.length - 90:
|
||||||
y = answer.get_height () - 100
|
y = answer.get_height () - 46.875
|
||||||
else:
|
else:
|
||||||
y = int ((answer.get_height () - 100) * (self.frame - 30) / (self.length - 120))
|
y = int ((answer.get_height () - 46.875) * (self.frame - 30) / (self.length - 120))
|
||||||
surface.blit (answer, (100, 150), Rect (0, y, 800, 100))
|
surface.blit (answer, (46.875, 70.3125), Rect (0, y, 375, 46.875))
|
||||||
self.game.screen.blit (surface, (0, 0))
|
self.game.screen.blit (surface, (0, 0))
|
||||||
super ().redraw ()
|
super ().redraw ()
|
||||||
|
|
||||||
@@ -625,7 +625,7 @@ class KitaSun (GameObject):
|
|||||||
game: Game,
|
game: Game,
|
||||||
):
|
):
|
||||||
super ().__init__ (game)
|
super ().__init__ (game)
|
||||||
self.surface = pygame.transform.scale (pygame.image.load ('./assets/sun.png'), (200, 200))
|
self.surface = pygame.transform.scale (pygame.image.load ('./assets/sun.png'), (93.75, 93.75))
|
||||||
self.sun = Sun ()
|
self.sun = Sun ()
|
||||||
|
|
||||||
def redraw (
|
def redraw (
|
||||||
@@ -658,7 +658,7 @@ class KitaSun (GameObject):
|
|||||||
self,
|
self,
|
||||||
) -> float:
|
) -> float:
|
||||||
return ((CWindow.HEIGHT / 2)
|
return ((CWindow.HEIGHT / 2)
|
||||||
- ((CWindow.HEIGHT / 2 + 100) * math.sin (self.alt)
|
- ((CWindow.HEIGHT / 2 + 46.875) * math.sin (self.alt)
|
||||||
/ math.sin (math.radians (60))))
|
/ math.sin (math.radians (60))))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -689,7 +689,7 @@ class Jojoko (GameObject):
|
|||||||
game: Game,
|
game: Game,
|
||||||
):
|
):
|
||||||
super ().__init__ (game)
|
super ().__init__ (game)
|
||||||
self.base = pygame.transform.scale (pygame.image.load ('./assets/moon.png'), (200, 200))
|
self.base = pygame.transform.scale (pygame.image.load ('./assets/moon.png'), (93.75, 93.75))
|
||||||
self.moon = Moon ()
|
self.moon = Moon ()
|
||||||
self.surface = self._get_surface ()
|
self.surface = self._get_surface ()
|
||||||
|
|
||||||
@@ -729,11 +729,11 @@ class Jojoko (GameObject):
|
|||||||
jojoko = self.base.copy ()
|
jojoko = self.base.copy ()
|
||||||
for i in range (200):
|
for i in range (200):
|
||||||
if 1 <= self.phase < 15:
|
if 1 <= self.phase < 15:
|
||||||
pygame.gfxdraw.bezier (jojoko, ((0, 100 + i), (100, 180 * self.phase / 7 - 80 + i), (200, 100 + i)), 3, (0, 255, 0))
|
pygame.gfxdraw.bezier (jojoko, ((0, (100 + i) * .468_75), (46.875, (180 * self.phase / 7 - 80 + i) * .468_75), (93.75, (100 + i) * .468_75)), 3, (0, 255, 0))
|
||||||
elif self.phase < 16:
|
elif self.phase < 16:
|
||||||
pass
|
pass
|
||||||
elif self.phase < 30:
|
elif self.phase < 30:
|
||||||
pygame.gfxdraw.bezier (jojoko, ((0, 100 - i), (100, 180 * (self.phase - 15) / 7 - 80 - i), (200, 100 - i)), 3, (0, 255, 0))
|
pygame.gfxdraw.bezier (jojoko, ((0, (100 - i) * .468_75), (46.875, (180 * (self.phase - 15) / 7 - 80 - i) * .468_75), (93.75, (100 - i) * .468_75)), 3, (0, 255, 0))
|
||||||
else:
|
else:
|
||||||
jojoko.fill ((0, 255, 0))
|
jojoko.fill ((0, 255, 0))
|
||||||
return jojoko
|
return jojoko
|
||||||
@@ -749,7 +749,7 @@ class Jojoko (GameObject):
|
|||||||
self,
|
self,
|
||||||
) -> float:
|
) -> float:
|
||||||
return ((CWindow.HEIGHT / 2)
|
return ((CWindow.HEIGHT / 2)
|
||||||
- ((CWindow.HEIGHT / 2 + 100) * math.sin (self.alt)
|
- ((CWindow.HEIGHT / 2 + 46.875) * math.sin (self.alt)
|
||||||
/ math.sin (math.radians (60))))
|
/ math.sin (math.radians (60))))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
新しい課題から参照
ユーザをブロックする