Hi. I have been using bb now for about 2 days. Im plodding on ok. I need help with this code. If its a mess im sorry. iv'e only just started. The problem Im having is with player movement. I want the player to be able to move left and right and have a different anim for each direction. this is wot I have come up with so far. Can anyone give any suggestions on a better way to accomplish this.
heres my code.
Graphics 640,480
SetBuffer BackBuffer()
px = 200
py = 200
pspeed = 1
pframe = 0
time = MilliSecs()
;load the player image
p = LoadAnimImage("image1.bmp",32,32,0,3)
While Not KeyHit(1)
Cls
If MilliSecs()> time + 100
time = MilliSecs()
pframe = (pframe + 1) Mod 3
EndIf
If pframe = 2
pframe = 0
End If
If KeyDown(205)
DrawImage p,px,py,pframe
px = px + 1
Else If KeyDown(203)
px = px -1
DrawImage p,px,py,2
pframe = 2 +1
If pframe = 3
pframe = 3
EndIf
Else
DrawImage p,px,py
End If
Flip
Wend
End
heres my code.
Graphics 640,480
SetBuffer BackBuffer()
px = 200
py = 200
pspeed = 1
pframe = 0
time = MilliSecs()
;load the player image
p = LoadAnimImage("image1.bmp",32,32,0,3)
While Not KeyHit(1)
Cls
If MilliSecs()> time + 100
time = MilliSecs()
pframe = (pframe + 1) Mod 3
EndIf
If pframe = 2
pframe = 0
End If
If KeyDown(205)
DrawImage p,px,py,pframe
px = px + 1
Else If KeyDown(203)
px = px -1
DrawImage p,px,py,2
pframe = 2 +1
If pframe = 3
pframe = 3
EndIf
Else
DrawImage p,px,py
End If
Flip
Wend
End