Yay! Great stuff, your some guy Gernot!
There goes my weekend..! time to play...
There goes my weekend..! time to play...
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: GernotFrischUhm... Select, right mouse button: "Copy", maybe?Scroll the compiler window to the top, locate the mouse to the top-left of the compiler window, hold down the left mouse button, pull down, this will highlight the compiler text and scroll the window to the bottom.
You can see the line numbers in the editor's status bar at the bottom.
If you have an error, simply double click on it to get there.
Quote from: bigsoftySomething like this...?Ha!, just noticed...IF KEY(30)
MOD(currentframe,5) // 0-4= running man for example
currentframe=currentframe+1
ELSE
currentframe=10 // 10=idle man stopped
ENDIF
DRAWSPRITE currentframe, -20, 255
MOD(currentframe,5) // 0-4= running man for example
currentframe=currentframe+1
should be reversed... to avoid currentframe overflowing currentframe=currentframe+1
MOD(currentframe,5) // 0-4= running man for example
doh!
GLOBAL myvar
myvar=3
PRINT "result="+myvar, 10, 10
SHOWSCREEN
KEYWAIT
This is pretty obvious, create a var, put a value in it and print it. Here's the same program using arrays...DIM myvar[1]
myvar[1]=3
PRINT "result="+myvar[0], 10, 10
SHOWSCREEN
KEYWAIT
This is kinda silly but it does illustrate how arrays and vars are just the same, a place to store values. In this case I've create a list of the length of 1, to store a single value. DIM myvar[4]
myvar[0]=3
myvar[1]=5
myvar[2]=6
myvar[3]=7
PRINT "result array 0="+myvar[0], 10, 10
PRINT "result array 1="+myvar[1], 10, 20
PRINT "result array 2="+myvar[2], 10, 30
PRINT "result array 3="+myvar[3], 10, 40
SHOWSCREEN
KEYWAIT
Now a 2 dimentional array, the list is replaced by a grid of variables, each one capable of holding a value. As its a grid each variable needs a unique 'X' and 'Y' co-ordinate to locate the individual items.DIM myvar[2][2] // 2 by 2 grid = 2*2 = 4 total variables
myvar[0][0]= 3 // 0,0 top left of 2 by 2 grid
myvar[1][0]= 5 // 1,0 top right of 2 by 2 grid
myvar[0][1]= 6 // 0,1 bottom left of 2 by 2 grid
myvar[1][1]= 7 // 1,1 bottom right of 2 by 2 grid
PRINT "result of array 0,0=" + myvar[0][0], 10, 10
PRINT "result of array 1,0=" + myvar[1][0], 10, 20
PRINT "result of array 0,1=" + myvar[0][0], 10, 30
PRINT "result of array 1,1=" + myvar[1][1], 10, 40
SHOWSCREEN
KEYWAIT
Now why use a 2 by 2 array (Grid), why not 'DIM mayvar[4]', well logically some data structures 'fit' into the idea of 2 dimentional array better than others...SELECT c1
CASE 0 GOTO 100
CASE 1 GOTO 100
CASE 2 GOTO 200
CASE 3 GOTO 200
CASE 4 GOTO 500
ENDSELECT
Not used in this example but the SELECT statement has extra commands for handling certain situations...CASE 6 TO 99 GOTO 200 // if C1 was between 6 and 99
or CASE >100 GOTO 100 // if C1 was greater then 100
orDEFAULT GOTO 300 // If C1 has a value that SELECT does not handle (eg... -10), same ELSE in an IF