summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLogan <logan@cflip.net>2023-01-30 16:56:22 -0700
committerLogan <logan@cflip.net>2023-01-30 16:56:22 -0700
commitf401ea5a25eafe87adc03b4f574ab7c41881763f (patch)
tree68a3ef0e62c6f408fdcf177984218e8bdfe61477 /scripts
parent1ee95daf42518e7beddb2e4a00549253b20966d2 (diff)
Ensure scores are only counted when object is basketball
Diffstat (limited to 'scripts')
-rw-r--r--scripts/hoop.gd13
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/hoop.gd b/scripts/hoop.gd
index c74afe6..77de7b4 100644
--- a/scripts/hoop.gd
+++ b/scripts/hoop.gd
@@ -4,12 +4,15 @@ signal score
var has_scored = false
-func _on_Area2D_body_exited(_body):
+func _on_Area2D_body_exited(body):
+ print(body)
+ if body.name == "Basketball":
# Prevent scoring multiple points with one basketball throw.
- if !has_scored and !global_variables.timer_zero:
- global_variables.score += 1
- has_scored = true
- emit_signal ("score")
+ if !has_scored and !global_variables.timer_zero:
+ print("SCORE!!!")
+ global_variables.score += 1
+ has_scored = true
+ emit_signal ("score")
func _on_Basketball_reset():
has_scored = false