Godot Version
4.3
Question
So i have the weird bug, there the Godot is working stange and i don’t know why.
So i have this Moving (Green) Platform, is a Animatable Body and the Player is a normal Charater2D. If the Player stands on the Platform (while is moving) and i paused the Game, it looks kinda like the game is near crashing.
I make a short video about it.
This happens only if the Player stand directly on the Platform.
If i press Pause - the Screen gets Grey and if prints “Player has falling out of the world” (aka player touches killzone below the level) this tiggers a player.diying -function and a restart. So it’s not gamebreaking, but it looks really buggy
If i disable the platform moving it works normal (so this only happens if the platform is moving is same way)
In the Commandline i print the player global_position, as you see the chnages to nan for some reason
The Code i used to pause the game
The pause Menu itself is a Autoload ( Canyaslayer with UI Elements )
func _process(_delta):
display_pause_menu()
update_UI()
func display_pause_menu():
if (
Input.is_action_just_pressed("Menu_key") and
bla bla bla
):
print("Menu_key was pressed")
if pause_menu.visible == false:
button_was_grabed = false
Gobal.game_paused = true
Gobal.show_HUD = false
pause_menu.visible = true
Engine.time_scale = 0 ###This one
else:
pause_menu.visible = false
Engine.time_scale = 1 ## and this one
Gobal.game_paused = false
if Gobal.in_cutscene == false:
Gobal.show_HUD = true
What i tryed so far:
- Before the game frezes (timescale = 0) lift the player position.y for some pixels
- After the game frezes (timescale = 0) lift the player position.y for some pixels
- change the timescale in 3-4 steps instead of 0 ( timescale = 0.8 /await frame /timescale = 0.6 /and so on )