summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2022-09-24 19:27:59 -0600
committercflip <cflip@cflip.net>2022-09-24 19:27:59 -0600
commit0d5aca0234e477d79d980677e6fbdf7c2d19b8fa (patch)
treedb93493984da9fea7d545fcedd269b107c0ab60d
parent420104f439c54a65b209f7e33c7dc8b7790d472a (diff)
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.
-rw-r--r--scripts/basketball.gd4
1 files changed, 2 insertions, 2 deletions
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"):