mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-29 02:23:22 +08:00
pubsync and ci fix
This commit is contained in:
parent
d6dca9e83f
commit
8e929e89f0
@ -14,7 +14,7 @@ import random
|
||||
import logging
|
||||
from enum import Enum
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, cast, Sequence
|
||||
|
||||
from typing_extensions import override
|
||||
import bascenev1 as bs
|
||||
@ -45,7 +45,7 @@ from bascenev1lib.actor.spazbot import (
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Sequence
|
||||
from typing import Any
|
||||
|
||||
|
||||
class Preset(Enum):
|
||||
@ -557,9 +557,7 @@ class RunaroundGame(bs.CoopGameActivity[Player, Team]):
|
||||
if self._lives < 5:
|
||||
hbtime = 0.39 + (0.21 * self._lives)
|
||||
self._lives_hbtime = bs.Timer(
|
||||
hbtime,
|
||||
lambda: self.heart_dyin(True, hbtime),
|
||||
repeat=True
|
||||
hbtime, lambda: self.heart_dyin(True, hbtime), repeat=True
|
||||
)
|
||||
self.heart_dyin(True)
|
||||
else:
|
||||
@ -1408,10 +1406,8 @@ class RunaroundGame(bs.CoopGameActivity[Player, Team]):
|
||||
def _set_can_end_wave(self) -> None:
|
||||
self._can_end_wave = True
|
||||
|
||||
def heart_dyin(self,
|
||||
status: bool,
|
||||
time: float = 1.22) -> None:
|
||||
""" Makes the UI heart beat at low health. """
|
||||
def heart_dyin(self, status: bool, time: float = 1.22) -> None:
|
||||
"""Makes the UI heart beat at low health."""
|
||||
assert self._lives_bg is not None
|
||||
if self._lives_bg.node.exists():
|
||||
return
|
||||
@ -1419,19 +1415,33 @@ class RunaroundGame(bs.CoopGameActivity[Player, Team]):
|
||||
|
||||
# Make the heart beat intensely!
|
||||
if status:
|
||||
bs.animate_array(heart, 'scale', 2, {
|
||||
0:(90,90),
|
||||
time*0.1:(105,105),
|
||||
time*0.21:(88,88),
|
||||
time*0.42:(90,90),
|
||||
time*0.52:(105,105),
|
||||
time*0.63:(88,88),
|
||||
time:(90,90),
|
||||
})
|
||||
bs.animate_array(
|
||||
heart,
|
||||
'scale',
|
||||
2,
|
||||
{
|
||||
0: (90, 90),
|
||||
time * 0.1: (105, 105),
|
||||
time * 0.21: (88, 88),
|
||||
time * 0.42: (90, 90),
|
||||
time * 0.52: (105, 105),
|
||||
time * 0.63: (88, 88),
|
||||
time: (90, 90),
|
||||
},
|
||||
)
|
||||
|
||||
# Neutralize heartbeat (Done did when dead.)
|
||||
else:
|
||||
bs.animate_array(heart, 'scale', 2, {
|
||||
0.0: list(heart.scale),
|
||||
time: (90,90),
|
||||
})
|
||||
# Ew; janky old scenev1 has a single 'Node' Python type so
|
||||
# it thinks heart.scale could be a few different things
|
||||
# (float, Sequence[float], etc.). So we have to force the
|
||||
# issue with a cast(). This should go away with scenev2/etc.
|
||||
bs.animate_array(
|
||||
heart,
|
||||
'scale',
|
||||
2,
|
||||
{
|
||||
0.0: cast(Sequence[float], heart.scale),
|
||||
time: (90, 90),
|
||||
},
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user