|Topic was automatically imported from the old Question2Answer platform.
Hi so Im working on a 2d platformer that has two different sets of items to collect that are kept track of with two different progress bars.
What is supposed to happen is that when the player picks up ten of the A Items, the A Progress bar is full and it changes scenes. Which does happen.
But I wanted to make it so that if the player had collected a certain amount of B Items they’d be sent to a different scene than usual.
this is the code on the player:
if Autoload.Glitches >= 3:
the work Accomplished is the signal the A progress bar sends out when 10 items have been collected
and Glitches is the name of the B Item
this is the script I have on the progress bar:
var works = 0
$workprogress/ProgressBar.value = works
if works == 10:
works = works + 1
if works == 10:
the work_done is a signal the A Item send when its been collected.
Everything works perfectly fine when I take the if else statement out of the code and just have it change scene, so I don’t think its an issue with the Items or the Progress Bar
Are you saying that with the
if/else, that the scene change isn’t happening at all or that it’s just not changing to the scene you expect?
Assuming you’re getting into your
_on_work_accomplished_3() function, you should be loading one of the two specified scenes based on the value of
Autoload.Glitches. Assuming you’re just getting the wrong scene, the cause is simply the value of
A debug break point in that function should make it easy to see what’s going wrong…
jgodfrey | 2023-06-05 16:31