Ok here is a working version with as little alteration as possible
Note that Rand(-1,1) might have returned 0 and so resulted in no movement at all.
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.