Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion arcade/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def shake(self, velocity: Vec2, speed: float = 1.5, damping: float = 0.9):
"""
Add a camera shake.

:param Vec2 velocity: Vector to start moving the camera
:param Vec2 velocity: Vector to start moving the camera. Needs to be
a pyglet.math.Vec2.
:param float speed: How fast to shake
:param float damping: How fast to stop shaking
"""
Expand Down
5 changes: 3 additions & 2 deletions arcade/examples/sprite_move_scrolling_shake.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import random
import math
import arcade
from pyglet.math import Vec2

SPRITE_SCALING = 0.5

Expand Down Expand Up @@ -157,7 +158,7 @@ def on_update(self, delta_time):
# How 'far' to shake
shake_amplitude = 10
# Calculate a vector based on that
shake_vector = (
shake_vector = Vec2(
math.cos(shake_direction) * shake_amplitude,
math.sin(shake_direction) * shake_amplitude
)
Expand All @@ -179,7 +180,7 @@ def scroll_to_player(self):
pan.
"""

position = (
position = Vec2(
self.player_sprite.center_x - self.width / 2,
self.player_sprite.center_y - self.height / 2
)
Expand Down