Having trouble with GENSPRITE() anytime i use it the program
builds but i get the message Start debug session.
but the program doesn't run
if i change GENSPRITE() to an actual number it runs fine
I might be overlooking something but right now i don't know what ...
SETCURRENTDIR("Media") // seperate media and binaries?
GLOBAL sprPlayer = GENSPRITE()
LOADSPRITE "player.png",sprPlayer
GLOBAL Quit = 0
SETSCREEN 320,480,0
WHILE Quit <> 1
DRAWSPRITE sprPlayer,0,0
SHOWSCREEN
WEND
Certainly does - however : as mentioned elsewhere, RGB is the only command that can be used to initialise variables. Any other command causes...problems...
It seems to work without the global declaration in debug/non debug and
running the executable file.
Yes, it would do..
GLOBAL sprPlayer = GENSPRITE()
and
sprPlayer = GENSPRITE()
are slightly different. The first specificly defines the type of variable whilst the second would leave to the compiler, with the result that if its invalid for the area where you are defining the variable, you will get either warning or an error - it will only work if you don't enable explicit declarations.
It would be nice if the compiler could spot this sort of thing and stop compiling with an error or something (perhaps only if explicit declarations are on).
I would like to see the compiler flag an error when declaring globals with a variable too!
Yes, but that's really hard to program for me. I tried several times already :/