GLBasic forum

Main forum => GLBasic - en => Topic started by: cobracon120 on 2011-Dec-30

Title: LOADSPRITE Help
Post by: cobracon120 on 2011-Dec-30
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?
Title: Re: LOADSPRITE Help
Post by: doimus on 2011-Dec-30
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.
Title: Re: LOADSPRITE Help
Post by: cobracon120 on 2011-Dec-30
Ohhh. I was following the tutorial and it never said anything about that. Thanks!
Title: Re: LOADSPRITE Help
Post by: bjimenez on 2011-Dec-31
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 .
Title: Re: LOADSPRITE Help
Post by: Schranz0r on 2011-Dec-31
copy all images to the ".app - folder" in your Projectfolder!
Or use:

Code (glbasic) Select
SETCURRENTDIR("Media") // go to media files

and put all in your ".app/Media-folder" thats the trick
Title: Re: LOADSPRITE Help
Post by: michael on 2011-Dec-31
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

Title: Re: LOADSPRITE Help
Post by: okee on 2012-Jan-01
Or use gensprite, much easier

Code (glbasic) Select
GLOBAL Options = GENSPRITE(); LOADSPRITE "images/options.png", Options
GLOBAL Title = GENSPRITE(); LOADSPRITE "images/title.png", Title
GLOBAL Button = GENSPRITE(); LOADSPRITE "images/button.png", Button
Title: Re: LOADSPRITE Help
Post by: matchy on 2012-Jan-01
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! ;)
Title: Re: LOADSPRITE Help
Post by: mentalthink on 2012-Jan-05
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...