extends Node
@onready var character_body_2d: CharacterBody2D = $"../CharacterBody2D"
var playery
var playerx
func _on_body_entered(body: Node) -> void:
print(body.name)
if body.name == "CharacterBody2D":
playerx = character_body_2d.position.x/1152
playerx = ceil(playerx)
playery = character_body_2d.position.y/648
playery = ceil(playery)
if playerx == 2 and playery == -2:
character_body_2d.position.x = 1217
character_body_2d.position.y = -447
This doesn’t work who knows why and I cant even check if playerx/playery are the right number because my print doesn’t work?
wchc
June 17, 2025, 5:31pm
2
Have you connected this callable to a signal? Either through code or in the inspector?
I suggest you to look into how signals work in general, maybe this will spark some ideas for you on how to fix your issue:
In this lesson, we will look at signals. They are messages that nodes emit when something specific happens to them, like a button being pressed. Other nodes can connect to that signal and call a fu...
wchc
June 17, 2025, 5:44pm
4
Can you show how you connected?
And what are you doing to make the signal trigger?
You need to provide a bit more information if you want to have any meaningful answer.