summaryrefslogtreecommitdiff
path: root/scripts/basketball.gd
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2022-09-30 21:20:48 -0600
committercflip <cflip@cflip.net>2022-09-30 21:20:48 -0600
commit1d485122123d59dfee0ddf6989f86832129f7220 (patch)
tree9b2b9cfc445374f046b1480b61e57c10a0c4e835 /scripts/basketball.gd
parentb76c6de83b01cddaf589669ef15081ffdbe6148b (diff)
Add an indicator for the last point where the ball was released
Diffstat (limited to 'scripts/basketball.gd')
-rw-r--r--scripts/basketball.gd10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/basketball.gd b/scripts/basketball.gd
index 9e95d35..bd3756b 100644
--- a/scripts/basketball.gd
+++ b/scripts/basketball.gd
@@ -27,6 +27,11 @@ func toggle_mode():
var shoot_power = -$Sprite.position * power_magnitude
apply_impulse(Vector2(2, 2), shoot_power)
+ var shootAngle = atan2($Sprite.position.y, $Sprite.position.x)
+ $ReleaseIndicator.visible = false
+ $ReleaseIndicator.position = $Sprite.position
+ $ReleaseIndicator.rotation = shootAngle - PI / 2
+
is_dragging = false
$GhostSprite.visible = false
$Sprite.position = Vector2(0, 0)
@@ -34,6 +39,11 @@ func toggle_mode():
# Adds offset of ball's rotation to sprite AFTER the entire object has rotated from physics.
# Done to keep appearance of same rotation to add consistency when resetting the ball.
$Sprite.rotation += rotation
+
+ # Hide the release indicator for the first throw in the next round
+ if !$"../Hoop".has_scored:
+ $ReleaseIndicator.visible = true
+
emit_signal("reset")
waiting_for_shoot = true
set_use_custom_integrator(waiting_for_shoot)