I would like to find a way to reset everything, as if my game was started for the first time. The problem is that when I hit the reset button (for testing) my player does not do his prepare animation, he just starts in idle. When I play for the first time, he does the animation just fine. Any suggestions would be greatly appreciated.

I think normally you would change the scene, like loading a level, and that would reset things. I'm not sure if loading the same level you are in will work, you might have to go to a temporary loading screen first (or maybe you can, not sure).

can you reinitialize the _ready(): function somehow with a reset?

You can reload the scene you are already in with something like this (untested, but I know the general concept works):

get_tree().change_scene(get_tree().current_scene.filename)

If the code you need to reinitialize is in ready and you know when you need to reinitialize, you may just be able to do something like node_here._ready(), which will call the function directly and it should run whatever code is there.

edit: One thing I should note though - reloading the scene using the snippet with get_tree above will make the game seem to freeze for a second, as it reloads the scene. It is probably a good idea to use a transition/loading scene as a intermediate transition, like @cybereality suggested, to avoid the perceived game freeze/lag when reloading the scene.

I've changed the topic type to Q&A and marked @TwistedTwigleg above post as answer. Will change the topic title and remove the unnecessary answered bit too.

2 years later