My current project revolves around the player(KinamaticBody2D) entering an Area2D to collect "ammo", but said Player can only do this once at a time, and each time he does so it's supposed to send him to a different state that ensures he can't collect more until he uses the ammo. My solution to this is to have the Area2D emit a signal to the Player, and the Player is supposed to receive it as a trigger to the next state. The problem is that I'm struggling to understand how these signals are supposed to be implemented, and nothing I've tried worked so far. Here's the signals I've tried:
Area2D:
signal Area
func _on_Area2D_body_entered(body):
if body.name == "Player":
emit_signal("Area")
Player:
func ready():
$Area2D.connect("body_entered", self, "_on_Player_body_entered")
func on_Player_body_entered():
if on_Player_body_entered():
state = STATE_B
Is there anything I'm doing wrong here?