LOADSPRITE Help

Previous topic - Next topic

cobracon120

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?

doimus

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.

cobracon120

Ohhh. I was following the tutorial and it never said anything about that. Thanks!

bjimenez

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 .

Schranz0r

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
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

michael

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


okee

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
Android: Samsung Galaxy S2 -  ZTE Blade (Orange San Francisco) - Ainol Novo 7 Aurora 2
IOS: 2 x Ipod Touch (1G)

matchy

#7
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! ;)

mentalthink

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...