Windows FOR STATEMENT NEED HELP!

ineephelp

Member
gml.pngunknown.pngunknown (1).png


i see that in the beginning, when the initial for loop is going through, it would draw whatever words in white or grey acoording to what I have set for menu_cursor
in this case, because I had set it to one, it would display "New Game" and "Quit" in grey,
while it would display "continue" in white because display cursor would be equal to var i, making it white.
but afterwards, assuming that "i" would be locked at 2 due to the fact that the for statement cannot go further because it has reached the max value, how will changing menu_cursor change which modes would be drawn in white or grey?
lets say that in the beginning i set menu_cursor to 1 (which it is), continue would be drawn in white while the rest would be drawn in grey
then, when i press the down arrow key to change the value of menu_cursor to 0(edited)
why would "Quit" be drawn in white even though the "i" value would be 2?
does the for loop repeat itself when the variable is changed? Im not sure because if that would be the case, in one frame per second there would be been an delay, which i dont see when i put that into play...(edited)
the only reasonable deduction that i could make is that the value of "i" would have many different values attached to it
but even so, how would you be able to tell if i would equal the value of menu_cursor?
just tell me how menu_cursor would be able to change whether the text would be drawn in white or grey
if the variable "i" which must equal to menu_cursor in order for the text to be white would not change?
how does the "i" variable change when it hits the end of the loop when it finished drawing 2?
I got the result that i wanted, but im unsure why the for loop acted the way it is acting that made it work
 
Last edited:

EvanSki

Raccoon Jam Host
a for loop runs every step unless you have a condition to prevent it from looping again, the draw event is called once per step
so basically how I think whats going on is your changing the color the for loop is ran, and the color is not updated until the next step causing the colors to act weird
 

ineephelp

Member
a for loop runs every step unless you have a condition to prevent it from looping again, the draw event is called once per step
so basically how I think whats going on is your changing the color the for loop is ran, and the color is not updated until the next step causing the colors to act weird
no i got what i wanted, but im unsure to why it would work. Thanks for the reply though!
 
Top