diff options
Diffstat (limited to 'scripts/basketball.gd')
-rw-r--r-- | scripts/basketball.gd | 10 |
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) |