Character global position resets when loading the scene

Godot Version

4.4.1

Question

`Anybody know a solution to this issue? I’ve made a options button and another button in the options menu to exit the options menu and when i tap that button my character resets global position because I load the fresh scene. Also I can still tap on the map while I’m in the options menu ://


`

Hi!

[…] my character resets global position because I load the fresh scene

I guess you explained the problem yourself. If you reload the scene, of course every node will be reset, including the player.
You could store his last position and re-assign it on scene loading, but if you’re just closing the options menu, I don’t see why you would reload the scene? Can’t you just set the options menu to not visible (or however you’re doing to show/hide it)? The scene reloading code should not be triggered here, or I may have misunderstood the problem.

Also I can still tap on the map while I’m in the options menu ://

It depends on how you handle mouse clicking on the map, but you should have a look at Mouse Filter documentation. It’s possible that you only have to set the option background’s mouse filter to Stop to catch mouse input and not propagate it elsewhere.
Or, in your code, you should be able to have some boolean to check if the options menu is open or not. If it is, then you can discard your clicks on map (that would work perfectly, but using this kind of technique may result in spaghetti code if used too much).

I’ll go find a tutorial and beging everything from the start because I’m so lost right now…


Thanks for trying to help