I have a really simple 2d game, zelda1-like movement, tilemapped, really super basic.
I’m running into an issue where the game freezes immediately after loading the main scene from the menu. like the scene appears, all the graphics are there, but the input is locked and animations don’t play.
Here’s the incredibly simple functioning code of the main menu:
if Input.is_key_pressed(KEY_SPACE):
get_tree().change_scene_to_file("res://Scenes/LoadingScrene.tscn")
that’s in the process function.
does anyone know why this happens? I’ve tried a loading screen as well and that doesn’t seem to help so I think it’s an issue on the end of the main scene. It’s not a very complicated scene, all the sprites and tiles are less than 32x32px and the map is pretty small. what’s happening?
there’s nothing wrong with changing scene to file method, and using KEY_SPACE, doesnt double input it, if it does then it should show error of null value, but it didnt, it loaded in your end
so it should be something wrong in your main scene script
show your mainscript if possible
it probably just not “gapless” scene change, as the godot needs to build from scratch for the new scene after removing all the previous one
the solution for this is to manually change the scene with remove and add child
while changing it tho, show a loading screen so it doesnt look like there’s grey scene before changing scene
above solution code is just a snippet, you will want to integrate it to fit your needs, but it didnt use change_scene_to_file method for changing scene
the loading panel can be on TopUI Layer (different and higher layer than basic UI CanvasLayer) that will show when triggered on changing scene