summaryrefslogtreecommitdiff
path: root/scripts/basketball.gd
diff options
context:
space:
mode:
authorLogan <logan@cflip.net>2022-09-27 12:39:47 -0600
committerLogan <logan@cflip.net>2022-09-27 12:39:47 -0600
commit70bcca81567d569ee5a17adc3447ac7bbd2f3d6e (patch)
tree812a7e2fc5d93454c82a52b8a51928b3f1e93d27 /scripts/basketball.gd
parent215c67a3aa6a07af05f3af6268bbc82d60925bcc (diff)
Add camera node and basic camera logic.
Diffstat (limited to 'scripts/basketball.gd')
-rw-r--r--scripts/basketball.gd6
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.