basketball-tactics/scripts/ball.gd

23 lines
540 B
GDScript3
Raw Permalink Normal View History

2026-02-11 03:01:44 +00:00
@icon("res://assets/icons/ball.svg")
class_name Ball
extends Area2D
var handler: Player: set = set_handler
var is_loose: bool = true: set = set_is_loose
## -- SETTERS --
func set_handler(h: Player) -> void:
handler = h
if handler:
print_debug("The ball is in %s's hands" % handler.attributes.player_name)
else:
print_debug("The ball is in noone's hands")
func set_is_loose(i_l: bool) -> void:
is_loose = i_l
if is_loose:
handler = null
print_debug("The ball is loose!")
else:
print_debug("The ball is no longer loose.")