diff options
author | Logan <logan@cflip.net> | 2022-09-24 20:14:43 -0600 |
---|---|---|
committer | Logan <logan@cflip.net> | 2022-09-24 20:14:43 -0600 |
commit | e916823ea84820e2be73c9dea3396845c1583c4b (patch) | |
tree | 930761c5135cbd464c17a23118f3ca6b8afc9e66 /scripts | |
parent | 5b32b0c4da2ab2fb1937a6b922dd7cb28448349e (diff) |
Add ghost sprite when dragging basketball.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/basketball.gd | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/basketball.gd b/scripts/basketball.gd index f55bc53..51137e3 100644 --- a/scripts/basketball.gd +++ b/scripts/basketball.gd @@ -41,6 +41,7 @@ func _integrate_forces(state): func _process(delta): if waiting_for_shoot: $Sprite.rotation += spin_speed * delta + $GhostSprite.rotation += spin_speed * delta if Input.is_action_pressed("ui_left"): start_position.x -= move_speed * delta if Input.is_action_pressed("ui_right"): @@ -50,6 +51,8 @@ func _process(delta): func _input(event): if event.is_action_pressed("shoot") and ready_to_hold: $Sprite.position = event.position - start_position + $GhostSprite.visible = true + $GhostSprite.rotation = $Sprite.rotation is_dragging = true if is_dragging and event is InputEventMouseMotion: $Sprite.position = event.position - start_position @@ -58,6 +61,7 @@ func _input(event): power = (start_position - event.position) * power_magnitude $Sprite.position = Vector2() is_dragging = false + $GhostSprite.visible = false toggle_mode() func on_OuterShape_mouse_entered(): |