From 0d5aca0234e477d79d980677e6fbdf7c2d19b8fa Mon Sep 17 00:00:00 2001 From: cflip Date: Sat, 24 Sep 2022 19:27:59 -0600 Subject: Only rotate basketball sprite instead of entire object This way if we want to move the sprite around, the rotation of the basketball will not cause the sprite to 'orbit' the origin. --- scripts/basketball.gd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/basketball.gd b/scripts/basketball.gd index d4a5a66..407c473 100644 --- a/scripts/basketball.gd +++ b/scripts/basketball.gd @@ -29,14 +29,14 @@ func shoot(): # Override the default physics when we want to manually set the position and rotation. func _integrate_forces(state): if waiting_for_shoot: - state.transform = Transform2D(spin_rotation, start_position) + state.transform.origin = start_position state.linear_velocity = Vector2() state.angular_velocity = 0 # Temporary testing controls func _process(delta): if waiting_for_shoot: - spin_rotation += spin_speed * delta + $Sprite.rotation += spin_speed * delta if Input.is_action_pressed("ui_left"): start_position.x -= move_speed * delta if Input.is_action_pressed("ui_right"): -- cgit v1.2.3