GLBasic forum

Main forum => GLBasic - en => Topic started by: Pahl on 2005-Dec-19

Title: Yup me again
Post by: Pahl on 2005-Dec-19
Still going through the tutorial and am up to "Sprites"

now the tutorial says to add the commands


LOADSPRITE "Bubble.bmp" ,0
SPRITE 0, 300, 150
SHOWSCREEN
END


thus resulting in a visible result. But all I'm getting is the window popping open then closing right away.  I added the line "MOUSEWAIT" and the window is blank. Now I've found  "Bubble.BMP" so I know it's there but for some reason it isnt loading.

Any help would be appreciated.


P.S. I appologize in advance. I'm determined to learn this and will consequently inundate you guys with, what will probably be, irritatingly noobish questions.
Title: Yup me again
Post by: Synthetic on 2005-Dec-19
Hehe, you will need to use a loop on this too. Almost every program will more than likely need a loop to keep it going. The only time you wouldn't want a loop is if you have a program that only needs to run once.

Here is the basic loop:

a = 1          // Goes before the loop. - This is to define a variable as true in the case for the while/wend loop.
while a = 1 // Goes at the start of the code to run. - Specifies that as long as variable a = 1, any code after "while a = 1"
                 // and before "wend" will continually run till the condition is false aka "a" doesn't = 1 anymore.
wend         // Goes at the end of the code. - This is the designation for the end of the while/wend loop

Adding it to the tutorial code, you should end up with something like this:

a = 1
LOADSPRITE "Bubble.bmp" ,0 // Always load graphics and such outside of a main loop as it will slow things down

while a = 1
SPRITE 0, 300, 150
SHOWSCREEN
wend

I hope this helps. :D
Title: Yup me again
Post by: Kitty Hello on 2005-Dec-19
This will heat up your PC, with no much visible result.
How about:
Code (glbasic) Select
WHILE 1=1 // forever
   a=a+1
   SPRITE 0, 100*SIN(a)+100, 150
   SHOWSCREEN
WEND
Title: Yup me again
Post by: Pahl on 2005-Dec-19
Thanx for the help guys. I'll give that a try later today.

So I'm guessing the tutorial is a little flawed then?


Pahl
Title: Yup me again
Post by: Synthetic on 2005-Dec-19
It's not that it's flawed but that it just shows the concepts of how to use commands. ;)