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