Godot set_text

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By furkan13246578

When you enter the character area in godot, the label should increase by +1, but when I use the code below, nothing happens.

    extends Area2D
var label = 0
func _on_Area2D_body_entered(body):
	if body.name == "Player":
		label += 1

You’ve posted the same question twice.

SteveSmith | 2022-11-30 15:43

You have not provided much information about this, but off the top of my head, I would think that either one of two things are happening:

  1. Your Player Node is not a KinematicBody2D or a StaticBody2D, but is an Area2D
  2. Your Player’s name is not “Player”. It is better to use groups for this BTW.
  3. Have you enabled Monitoring on the Area2D node?
  4. Check your Collision Masks for both the Player Node and the Area2D node.

Juxxec | 2022-11-30 22:07