file location

Previous topic - Next topic

lysander23

I'm a beginner and trying to use LOADBMP, but I can't find the bmp file. I've tried different folders and nothing seems to work. DOESFILEEXIST() comes up false every time. Can someone help me? Thanks!

Poetronic

I'd say please post your code :-)
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

Ian Price

You need to place your media in the "YOUR APP NAME".app/Media file of your project.

Ensure you then use -
Code (glbasic) Select
SETCURRENTDIR("Media") // go to media files

(it's remarked out at the start of every new project - just remove the "//")
I came. I saw. I played.

mentalthink

Hi Welcome... not it´s too much complex...

Yo have to do like say Ian... "delete the first comment... says something Setcurrentdir("Media")

When you do this... you game or application it´s looking this folder...

If you go to tools-openfolder menu... your Windows show the folder of the project, into this folder it´s finished .app, into it you have your media folder...here copy and paste your graphics sounds... and perhpas some txt..

Now put in your code somehting like this

Loadsprite "my_Image.png", 1    //Load sprite whit some name and extension.png, and assign the 1 for the id***

//this it´s combined whit the lat line WEND... and do a bucle infinite
while true               
//This say... hey draw the image whit the ID = 1 //Rebember you are loaded before my_Image.png whit the ID 1
drawsprite 1,0,0     

//Always you have to put this code... this it´s the refesh for the screen if you don´t put, you can´t show nothing in the screen
showscreen   


wend
//The program finish but turn again to start in the While command, and so on to the infinite

NOTE: When you add a ID to a sprite , bmp, sound or something it´s better apply a name like a varible...

In example:

global my_Sprite = 1

loadsprite "something.png", my_Sprite

and now when you want draw the image call to my_Sprite and not to 1... in large codes it´s very easyng confusing using only numbers

Another thing... always when starting whit GLbasic somepeople asked... you have to declare always the kind the variable...
GLOBAL some_Variable
LOCAL some_Variable
STATIC some_Variable

else you will have an error from the Compiler... (If you don´t want declare nothing... amke this:

go to

Project Options, and unchek the box says... Explicits Declarations... NOT REcomendable
)


Regards,
and Welcome

MrTAToad

It sounds like you are loading the graphic from the correct location (or it's not present)...

A simple solution :

Put media in the "Media" directory
Use :

Code (glbasic) Select
LOADBMP "Media/<file>"
SHOWSCREEN
]KEYWAIT

bigsofty

Is you O.S. that your using filename case sensitive?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

lysander23

Thanks! You guys are great! Why can't this info be in the reference under loadbmp?


mentalthink

HI lysander23, GLbasic have a very good help, but nobody knows about books... You have a few books on Lulu Books, on you can learn all, from the basic to a very High-Level whit Glbasic... not are expensive about 8 ot 10€ the more complex... You can find putting in Lulu Books search GLbasic... be carefull you have to be in the UK market... at least in Spain don´t appears... 

Some books are for the IDE, and I think the most important it´s Programmer´s Guide, or something like this I never rebember well the name (Mr T will  >:D=D

GLBasic it´s perfect... I´m not programmer and make 3 years I don´t know make nothing , and whit GLbasic and the help in the forum... you always have a reply for someone... in few weeks you have a simple game do it.. I´m in 3 months, from month 1 when I buyed Glbasic to 3 months in forward I do and I uploaded a game in the AppStore...

Don´t care it´s easy, fun and very very productive.