My scene isn’t reloading properly, can anybody help?
I implied a win/lose system based on a tutorial I watched on YouTube and it should give the player the ability toe reloading the level after failure. However, the reloading feature doesn’t seem to work probably. Even though the scene reloads, the player still all the weapons and ammo they’ve picked; that doesn’t make sense to me since the player’s health reloaded probably. Also, I haven’t even implemented a save system yet; I’m confused!
I never had this problem before when I followed the tutorial in question but, that’s probably because I wasn’t following the tutorial “properly” back then. Back then, I refused to signals use auto-loaded to manage the game with signals as the tutorial instructed.
Instead, what I did was add a screen to the top node in the level and then managed the whole level with that one script. If I wanted to transfer info from place to another, I’d just use “owner” a lot. When I did things my way; everything was just fine.
However, what inspired me to disobey the tutorial was pure laziness; I didn’t want to learn about using signals with code. So when the opportunity presented itself, I followed the tutorial “properly” as much as possible and that’s when the problem I describe manifested.
Perhaps I made some sort of mistake following the tutorial or perhaps it’s a problem with the version of Godot I’m using now (3.5); there is also the possibility that the tutorial just wasn’t made for a game as complicated as mine. Here is the code I use for reloading the scene:
func _input(event):
if Input.is_action_just_pressed("reload") and ( win == true or lose == true):
get_tree().reload_current_scene()
Here is a link to the tutorial I was following:
Now I’m not in a rush to fix this problem, because I’ve other issues with my game that I’m trying to sort out. However, this is a huge problem for me and I don’t even know how to fix. Could anyone give me some help?