• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Rooms not working

conman06

Member
I'm trying to program my game to go to the next room after the door animation plays, which is activated when the player presses up arrow. I don't understand why it isn't working.
 

Attachments

samspade

Member
I'm trying to program my game to go to the next room after the door animation plays, which is activated when the player presses up arrow.
You're checking if image index == 7. That is very unlikely to ever be true. You can use show_debug_message(image_index) to see the actual value of image index but unless you have the exact amount of frames for it to increase by an integer that check will never fire. You likely want >= 7 or perhaps the GM Event Animation End.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Conditionals in your code will not wait until they are fulfilled. If they aren't evaluating to true, they're skipped and never checked again unless you explicitly re-check (by running that code again). Your code executes within the scope of a single moment in time. Abandon any notion of any type of construct that roughly translates to "wait until" - there is no "wait until" (e.g. image_index is 7) outside of repeating loops that stall execution until their condition is true. Your code is merely "if colliding, up was pressed and image_index is exactly 7 at this point in time".

The Animation End event is the way to go here, as this will fire when an instance's animation has just ended, and presumably you want something to happen once that is the case.
 

conman06

Member
Conditionals in your code will not wait until they are fulfilled. If they aren't evaluating to true, they're skipped and never checked again unless you explicitly re-check (by running that code again). Your code executes within the scope of a single moment in time. Abandon any notion of any type of construct that roughly translates to "wait until" - there is no "wait until" (e.g. image_index is 7) outside of repeating loops that stall execution until their condition is true. Your code is merely "if colliding, up was pressed and image_index is exactly 7 at this point in time".

The Animation End event is the way to go here, as this will fire when an instance's animation has just ended, and presumably you want something to happen once that is the case.
Thank you sm for the help! This makes more sense now..
 
Top