Hi all,
My game is coming along nicely (thanks for guidance in at least one other thread!) but I notice I have a huge amount of global variables at the top of my code, as I don't know how to use local variables effectively.
Say I want to do a quick 'fade' loop (using alpha):
This is a minimal part of code inside my main loop. Where do I define the local variables? If I do them inside the loop, they initialise each iteration and of course, the values from the previous iteration are lost.
Would someone just be able to advise me with a simple example, maybe? I've looked through various other code but can't immediately work it out.
Cheers!
My game is coming along nicely (thanks for guidance in at least one other thread!) but I notice I have a huge amount of global variables at the top of my code, as I don't know how to use local variables effectively.
Say I want to do a quick 'fade' loop (using alpha):
If var_coinalpha<1 And var_coinalphadir=0 Then var_coinalpha:+0.02 End If If var_coinalpha>=1 Then var_coinalphadir=1 If var_coinalpha>0 And var_coinalphadir=1 Then var_coinalpha:-0.02 End If If var_coinalpha<=0 Then var_coinalphadir=0
This is a minimal part of code inside my main loop. Where do I define the local variables? If I do them inside the loop, they initialise each iteration and of course, the values from the previous iteration are lost.
Would someone just be able to advise me with a simple example, maybe? I've looked through various other code but can't immediately work it out.
Cheers!