WTF? Globals only in main program??!!

Blitz3D Forums/Blitz3D Beginners Area/WTF? Globals only in main program??!!

Your code, Iso:

Graphics 640,480,32,1
Color Rnd(0,255),Rnd(100,255),Rnd(50,255)
Rect 0,0,640,480
Global gfx1
Global gfx1=LoadImage("player.bmp")
WaitKey()
End
Stop Until End

is really entertaining, but don't feel offended. You just hack your way trough it by trial and error, and that's ok. Here is my version of your Code. I think you want to display the image you just loaded? because Loading does not automaticly display it.

Graphics 640,480,32,1 
setbuffer backbuffer() ; direct gfx operations to backbuffer

Global gfx1 
gfx1=LoadImage("player.bmp") 

while not keyhit(1) ; loop until someone presses ESC
 Color Rnd(0,255),Rnd(100,255),Rnd(50,255) 
 Rect 0,0,640,480 ,1
 drawimage gfx1, mousex(), mousey()
 Flip ; swap workbuffer (backbuffer) and visible buffer (frontbuffer)
wend
End