Skip to content

Commit

Permalink
Fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Cleptomania committed Mar 15, 2024
1 parent 5d5cfa5 commit 4b94361
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion arcade/examples/particle_fireworks.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def firework_spark_mutator(particle: FadeParticle):


def rocket_smoke_mutator(particle: LifetimeParticle):
particle.scale = lerp(0.5, 3.0, particle.lifetime_elapsed / particle.lifetime_original)
particle.scale = lerp(0.5, 3.0, particle.lifetime_elapsed / particle.lifetime_original) # type: ignore


if __name__ == "__main__":
Expand Down
16 changes: 8 additions & 8 deletions arcade/examples/sprite_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, bar_list: arcade.SpriteList) -> None:
scale=SPRITE_SCALING_PLAYER,
)
self.indicator_bar: IndicatorBar = IndicatorBar(
self, bar_list, (self.center_x, self.center_y), scale=1.5,
self, bar_list, (self.center_x, self.center_y), scale=(1.5, 1.5),
)
self.health: int = PLAYER_HEALTH

Expand Down Expand Up @@ -98,7 +98,7 @@ def __init__(
width: int = 100,
height: int = 4,
border_size: int = 4,
scale: float = 1.0,
scale: Tuple[float, float] = (1.0, 1.0),
) -> None:
# Store the reference to the owner and the sprite list
self.owner: Player = owner
Expand All @@ -110,7 +110,7 @@ def __init__(
self._center_x: float = 0.0
self._center_y: float = 0.0
self._fullness: float = 0.0
self._scale: float = 1.0
self._scale: Tuple[float, float] = (1.0, 1.0)

# Create the boxes needed to represent the indicator bar
self._background_box: arcade.SpriteSolidColor = arcade.SpriteSolidColor(
Expand Down Expand Up @@ -206,8 +206,8 @@ def fullness(self, new_fullness: float) -> None:
else:
# Set the full_box to be visible incase it wasn't then update the bar
self.full_box.visible = True
self.full_box.width = self._bar_width * new_fullness * self.scale
self.full_box.left = self._center_x - (self._bar_width / 2) * self.scale
self.full_box.width = self._bar_width * new_fullness * self.scale[0]
self.full_box.left = self._center_x - (self._bar_width / 2) * self.scale[0]

@property
def position(self) -> Tuple[float, float]:
Expand All @@ -224,15 +224,15 @@ def position(self, new_position: Tuple[float, float]) -> None:
self.full_box.position = new_position

# Make sure full_box is to the left of the bar instead of the middle
self.full_box.left = self._center_x - (self._bar_width / 2) * self.scale
self.full_box.left = self._center_x - (self._bar_width / 2) * self.scale[0]

@property
def scale(self) -> float:
def scale(self) -> Tuple[float, float]:
"""Returns the scale of the bar."""
return self._scale

@scale.setter
def scale(self, value: float) -> None:
def scale(self, value: Tuple[float, float]) -> None:
"""Sets the new scale of the bar."""
# Check if the scale has changed. If so, change the bar's scale
if value != self.scale:
Expand Down

0 comments on commit 4b94361

Please sign in to comment.