Skip to content

Commit 98879bb

Browse files
pvcravenPaul V Cravenclaude
authored
Say what units sprite velocity and change_angle are in (#2958)
Sprite speeds are per frame at 60 FPS, which the velocity, change_x, change_y and change_angle docstrings didn't say (#2397). Co-authored-by: Paul V Craven <paul.craven@optimizley.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9ec7bc8 commit 98879bb

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎arcade/sprite/sprite.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def __init__(
9797
# Movement
9898
self._velocity = 0.0, 0.0
9999
self.change_angle: float = 0.0
100-
"""Change in angle per 1/60th of a second."""
100+
"""Change in angle, in degrees per frame at 60 FPS."""
101101

102102
# Custom sprite properties
103103
self._properties: dict[str, Any] | None = None
@@ -188,7 +188,8 @@ def radians(self, new_value: float) -> None:
188188
@property
189189
def velocity(self) -> Point2:
190190
"""
191-
Get or set the velocity of the sprite.
191+
Get or set the velocity of the sprite, in pixels per frame at 60 FPS.
192+
For example, ``(5, 0)`` moves 300 pixels per second to the right.
192193
193194
The x and y velocity can also be set separately using the
194195
``sprite.change_x`` and ``sprite.change_y`` properties.
@@ -205,7 +206,7 @@ def velocity(self, new_value: Point2) -> None:
205206

206207
@property
207208
def change_x(self) -> float:
208-
"""Get or set the velocity in the x plane of the sprite."""
209+
"""Get or set the x velocity, in pixels per frame at 60 FPS."""
209210
return self.velocity[0]
210211

211212
@change_x.setter
@@ -214,7 +215,7 @@ def change_x(self, new_value: float) -> None:
214215

215216
@property
216217
def change_y(self) -> float:
217-
"""Get or set the velocity in the y plane of the sprite."""
218+
"""Get or set the y velocity, in pixels per frame at 60 FPS."""
218219
return self.velocity[1]
219220

220221
@change_y.setter

0 commit comments

Comments
 (0)