diff options
Diffstat (limited to 'scripts/basketball.gd')
-rw-r--r-- | scripts/basketball.gd | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/basketball.gd b/scripts/basketball.gd index cc9dfa6..cc794ce 100644 --- a/scripts/basketball.gd +++ b/scripts/basketball.gd @@ -11,7 +11,7 @@ var waiting_for_shoot = true var mouse_over_ball = false func _ready(): - start_position = position + start_position = global_position # This function toggles between dragging the ball for a shot and allowing the physics engine to move # the ball, setting any necessary properties along the way. @@ -48,11 +48,11 @@ func _process(delta): func _input(event): if event.is_action_pressed("shoot") and mouse_over_ball and waiting_for_shoot: is_dragging = true - $Sprite.position = event.position - start_position + $Sprite.position = get_global_mouse_position() - start_position $GhostSprite.visible = true $GhostSprite.rotation = $Sprite.rotation if is_dragging and event is InputEventMouseMotion: - $Sprite.position = event.position - start_position + $Sprite.position = get_global_mouse_position() - start_position # If the mouse pointer is beyond a certain radius, don't move the sprite any further from # the start position while still keeping it at the same angle as the mouse pointer. |