Skip to content

Commit e5f842c

Browse files
author
Paul V Craven
committed
#1479 Fix for error during camera shake example.
1 parent 1556d5b commit e5f842c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

arcade/camera.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ def shake(self, velocity: Vec2, speed: float = 1.5, damping: float = 0.9):
145145
"""
146146
Add a camera shake.
147147
148-
:param Vec2 velocity: Vector to start moving the camera
148+
:param Vec2 velocity: Vector to start moving the camera. Needs to be
149+
a pyglet.math.Vec2.
149150
:param float speed: How fast to shake
150151
:param float damping: How fast to stop shaking
151152
"""

arcade/examples/sprite_move_scrolling_shake.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import random
1111
import math
1212
import arcade
13+
from pyglet.math import Vec2
1314

1415
SPRITE_SCALING = 0.5
1516

@@ -157,7 +158,7 @@ def on_update(self, delta_time):
157158
# How 'far' to shake
158159
shake_amplitude = 10
159160
# Calculate a vector based on that
160-
shake_vector = (
161+
shake_vector = Vec2(
161162
math.cos(shake_direction) * shake_amplitude,
162163
math.sin(shake_direction) * shake_amplitude
163164
)
@@ -179,7 +180,7 @@ def scroll_to_player(self):
179180
pan.
180181
"""
181182

182-
position = (
183+
position = Vec2(
183184
self.player_sprite.center_x - self.width / 2,
184185
self.player_sprite.center_y - self.height / 2
185186
)

0 commit comments

Comments
 (0)