Skip to content

Commit d62528d

Browse files
CleptomaniaDigiDuncan
authored andcommitted
Fix examples
1 parent 97ec420 commit d62528d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

arcade/examples/particle_fireworks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def firework_spark_mutator(particle: FadeParticle):
359359

360360

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

364364

365365
def main():

arcade/examples/sprite_health.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(self, bar_list: arcade.SpriteList) -> None:
5252
scale=SPRITE_SCALING_PLAYER,
5353
)
5454
self.indicator_bar: IndicatorBar = IndicatorBar(
55-
self, bar_list, (self.center_x, self.center_y), scale=1.5,
55+
self, bar_list, (self.center_x, self.center_y), scale=(1.5, 1.5),
5656
)
5757
self.health: int = PLAYER_HEALTH
5858

@@ -98,7 +98,7 @@ def __init__(
9898
width: int = 100,
9999
height: int = 4,
100100
border_size: int = 4,
101-
scale: float = 1.0,
101+
scale: Tuple[float, float] = (1.0, 1.0),
102102
) -> None:
103103
# Store the reference to the owner and the sprite list
104104
self.owner: Player = owner
@@ -110,7 +110,7 @@ def __init__(
110110
self._center_x: float = 0.0
111111
self._center_y: float = 0.0
112112
self._fullness: float = 0.0
113-
self._scale: float = 1.0
113+
self._scale: Tuple[float, float] = (1.0, 1.0)
114114

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

212212
@property
213213
def position(self) -> Tuple[float, float]:
@@ -224,15 +224,15 @@ def position(self, new_position: Tuple[float, float]) -> None:
224224
self.full_box.position = new_position
225225

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

229229
@property
230-
def scale(self) -> float:
230+
def scale(self) -> Tuple[float, float]:
231231
"""Returns the scale of the bar."""
232232
return self._scale
233233

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

0 commit comments

Comments
 (0)