|Topic was automatically imported from the old Question2Answer platform.
Edit: I fixed it! I’m not honestly 100% sure what happened but somehow the names of the collision-bodies had changed so the code didn’t match anymore. Or at least, I think that’s what happened.
Anyway, as I was trying to get this to work with autoloads, I somehow did something that made it so that when I touch an enemy or collect all the gems, instead of sending me to a game over screen or the you win screen, it just straight up crashes the game. I’ve tried to disable all the speedrunning stopwatch stuff, and looked thru everything I can, and it’s telling me there’s an error with the get_tree function, but I can’t for the life of me figure out what the problem is.
“The function ‘change_scene()’ returns a value, but this value is never used.” is all the error message says. I have the correct scene addresses in place tho as far as I know
Anyway here’s an imgur link with a snippet of me playing the game and it crashing, as well as showing my code in case something glaring sticks out. I did notice in recording this that the change scene function to start the game works fine, it’s only the fail and win states that seem to be the problem. Imgur: The magic of the Internet
(Oh and I just checked the game over and you win menus and their buttons work just fine, so it’s only the collision based functions from my character to the gems and enemies that aren’t working properly. I can collect the gems and the enemies can kill me, but it just doesn’t send me to the right place, it bricks the game.
Can you try changing your scene name to
Enfyna | 2023-04-02 13:45
wait what would that do?
also it’s not working for 2 different scenes. You win on collecting all the gems, and you lose on touching an enemy. they both worked before and I haven’t changed the names…
sheathimony | 2023-04-03 13:51
Yeah sorry it is generally not a good idea to use spaces in naming so I thought that was it and didnt look at the rest. I looked at it now again but your
change_scene() functions doesnt seem to be at fault here. You said you added some timers and stuff so can you check if your timeout functions are working properly. Just put a
print("scene should change now") on top of your change_scene()` function and if it doesnt print after you hit a enemy you probably broke your timers.
Enfyna | 2023-04-03 14:23
Ah! Yes, I did change that and it didn’t help, but it did get me noticing that somehow the zombie ball’s name didn’t match what was in the code. Idk how I messed that up but fixing it fixed the problem! So your comment still led me in the right direction! And now I know to keep better track of file names for scenes and objects.
sheathimony | 2023-04-03 14:27