From e5f842cbad58184cea15d662fee298826d5f786c Mon Sep 17 00:00:00 2001 From: Paul V Craven Date: Mon, 30 Jan 2023 08:40:23 -0600 Subject: [PATCH] #1479 Fix for error during camera shake example. --- arcade/camera.py | 3 ++- arcade/examples/sprite_move_scrolling_shake.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arcade/camera.py b/arcade/camera.py index 552b27293..f2831ab16 100644 --- a/arcade/camera.py +++ b/arcade/camera.py @@ -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 """ diff --git a/arcade/examples/sprite_move_scrolling_shake.py b/arcade/examples/sprite_move_scrolling_shake.py index bb1767b52..5be42d888 100644 --- a/arcade/examples/sprite_move_scrolling_shake.py +++ b/arcade/examples/sprite_move_scrolling_shake.py @@ -10,6 +10,7 @@ import random import math import arcade +from pyglet.math import Vec2 SPRITE_SCALING = 0.5 @@ -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 ) @@ -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 )