I’m aligning dungeons and I can’t get this while loop to work, I do it by moving the dungeons until two points are aligned, and the game doesn’t show that they are moving, and I don’t know what’s happening, can you help me? (here’s the code):
while Room.get_node("Exit_Entreance/Entreance").global_position.y != pre_Room.get_node("Exit_Entreance/Exit").global_position.y: align() if Room.get_node("Exit_Entreance/Entreance").global_position.y == pre_Room.get_node("Exit_Entreance/Exit").global_position.y: break
func align() -> void: if Room.get_node("Exit_Entreance/Entreance").global_position.y < pre_Room.get_node("Exit_Entreance/Exit").global_position.y: print("Down") Room.position.y += 1 print(Room.get_node("Exit_Entreance/Entreance").global_position.y) if Room.get_node("Exit_Entreance/Entreance").global_position.y > pre_Room.get_node("Exit_Entreance/Exit").global_position.y: print("UP") Room.position.y -= 1 print(Room.get_node("Exit_Entreance/Entreance").global_position.y) if Room.get_node("Exit_Entreance/Entreance").global_position.y == pre_Room.get_node("Exit_Entreance/Exit").global_position.y: print("Aligned")
Please don’t use screenshots to show your code, use three ` at the beginning and the end of code
It’s almost impossible to read and point to code from a photo, especially when you’re using this font, I highly recommend using a more standard font like Jet Brains Mono so you don’t get dizzy while coding!
I don’t think you need a while loop here at all. If I may suggest, I think this piece of code will do exactly the same as your whole while loop and align() function.