it draws the sprite but the if will not work Basic is more confusing than c lol
I am gessing it is a simple mistake
LOADSPRITE "bubble.png",0
LET x=250
DRAWSPRITE 0,x,0
SHOWSCREEN
IF KEY (203) = 1
PRINT "key pressed", 20, 20
SHOWSCREEN
ENDIF
MOUSEWAIT
END
There are a number of things wrong with your code -
1. You are not running the IF...ENDIF in a loop, so basically the code is only checking ONCE for the keypress and it occurs before you can even react!
2. You don't need SHOWSCREEN in the IF ... ENDIF
3. Place your SHOWSCREEN at the end of any loop
4. You don't need the "=1" after a keytest
5. You don't need LET
6. GLB is a LOT simpler than C, but just as powerful
Here is a working example of your code
// Load sprite image
LOADSPRITE "bubble.png",0
// Loop this code until ESC pressed
WHILE TRUE
// Define variable X
x=250
// Draw image
DRAWSPRITE 0,x,0
// Print something if key pressed
IF KEY (203)
PRINT "key pressed", 20, 20
ENDIF
// Update screen
SHOWSCREEN
// End loop
WEND
Anyway, good luck and have fun :)
Thank you i should have rememberd the while loop and i like let i looks more complicated with it
Why do you need easy code that looks complicated?
The enduser won´t see your code :P
If you want your code to look complicated, you'll <3 this language.
http://en.wikipedia.org/wiki/Malbolge (http://en.wikipedia.org/wiki/Malbolge) :S
nice! :help: :whip: