newbie question...

Blitz3D Forums/Blitz3D Beginners Area/newbie question...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Ok here is a working version with as little alteration as possible

Graphics 300,400,0,2 

Type luis 
Field x,y 
Field image 
Field dirx 
End Type 


Global player.luis = New luis 
player\image = LoadImage ("pingui.bmp") 
ScaleImage player\image,.20,.20 
;position pingui and set the start direction here
player\x = 100 
player\y = 100 
player\dirx = 1 

While Not KeyDown(1) 
Cls 
DrawImage player\image,player\x,player\y 
testpingui() 
player\x = player\x + player\dirx 
Flip 
Wend 

Function testpingui() 
If player\x < 0 Or player\x > 290 
player\dirx = -player\dirx 
EndIf 
End Function 


Note that Rand(-1,1) might have returned 0 and so resulted in no movement at all.