Problem with picking up coins

Godot Version

GODOT 4.5

Question

I have out some coins among the level; intention is: player can pick up them just by going trough.

The scrpt attached to area2D named coins is:

extends Area2D


@onready var gamemanager: Node = %gamemanager

func _on_body_entered(body: Node2D) -> void:
	print('get coin!!')

when i am running the game for trying it despite the player goes. trough the coin I dont see ‘get coin!!’ printed out…i am stuck on it

What collisionlayer is the player on and what is the collisionmask of your coin?

1 Like

Put queue_free() below the print statement to check if it it detects the player. If it doesn’t you may need to check layer and if the signal is properly connected.

1 Like

What class type is the player?

1 Like

ok, just now i checked and indeed collisionlayer and collision mask were different(i just get wrong); now i set same value for both of them and it works.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.