Hello world of GLBasic! I'm new to this, with very little BASIC experience, and I'm trying to figure something out. Following one of the tutorials, I came across a command:
LOADSPRITE "player.bmp", 0
which is fine, yet when I run the program, player.bmp doesn't ever show up and yes I also put in the command: "DRAWSPRITE 0, px, py"
(px and py are global variables which I had set earlier). I've tried to add player.bmp to my list of files with the program, and I do have the actual bmp image within the directory that this program is saved in. How do I get the sprite to show?
You have to place graphics inside the .app folder.
If you have project called Mygame, then place your graphics inside the /Mygame/Mygame.app folder. You don't have to add them to the file list - that's for source code only.
Ohhh. I was following the tutorial and it never said anything about that. Thanks!
hi,
I'm learning this language too and yes some things I think are assumed to be known or assumed easy to figure out, but for beginners it can be a headache .
copy all images to the ".app - folder" in your Projectfolder!
Or use:
SETCURRENTDIR("Media") // go to media files
and put all in your ".app/Media-folder" thats the trick
and do not start with sprite counter by 0, better start by 1, I had with a big project problem after showscreen when there was a sprite defined with nr. 0. I don't now why but after I have fixit to 1 the screens show correctly :S
LOADSPRITE "./Media/spritename.png",1
Or use gensprite, much easier
GLOBAL Options = GENSPRITE(); LOADSPRITE "images/options.png", Options
GLOBAL Title = GENSPRITE(); LOADSPRITE "images/title.png", Title
GLOBAL Button = GENSPRITE(); LOADSPRITE "images/button.png", Button
It's been suggested before, the first command recommended before generating a valid GENSPRITE() and LOADSPRITE is to check IF DOESFILEEXIST(filename$) for debugging! Encapsulate this into a function and it will save future headaches! ;)
HI a little trick, for newbies, it´s copy your files to Media Folder, select the files waht do you want (.PNG . BMP & [3D objects, .dda])... goes again to editor and paste --- whit right mouse .... you will have the same name , and sure 100% it´s works without probles...
Warnig if you make this, dont use the first line in the code... this says something like SETCURRENTDIR (MEdia), don´t use it whit this method...
In wav and mp3 files, now I don´t rebember if works...
Warnig, .JPG files don´t works. this little trick...
I´m not sure, but drag and drop I think works too... !!!
And well... cobracon120 welcome to this awesome communty...