Not sure

BlitzPlus Forums/BlitzPlus Beginners Area/Not sure

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.

Hey friends,
Im a new to this code and am not sure if I am doing this right. I'm also not sure if I am drawing a new picture each and every time I move. Does this look right?

Thanks

ps. does anyone know if the "Learn how to program with Blitz 2D" is any good?


Graphics 640,480
SetBuffer BackBuffer()
Global player=LoadImage("graphics\alien.bmp")
Global speed=3
Global p.player=New player

Type player
Field x,y
End Type

While Not KeyHit(1)

updateplayer()
drawplayer()
Wend
FreeImage player
End

Function updateplayer()

If KeyDown(203) Then p\x=p\x - speed
If KeyDown(205) Then p\x=p\x + speed
If KeyDown(200) Then p\y=p\y - speed
If KeyDown(208) Then p\y=p\y + speed

If p\x<-25 Then p\x=650
If p\y<-25 Then p\y=490
If p\x>650 Then p\x=-25
If p\y>490 Then p\y=-25
End Function

Function drawplayer()
Cls
DrawImage player,p\x,p\y
Flip
End Function