Hey everyone,
I just purchased BlitzPro3D a few hours ago and I'm lovin' it. Right now I'm trying to do some 2D animation and I'm having some trouble. I'm able to have it loop the correct animation when the left and right arrow keys are being pressed, but I also want to add a "standing" animation. I've sort of got it working, but the way I've coded it makes you see a quick flip of animation as it does the calculations for finding the right frame on the animation strip.
Here's the code and the two image filmstrips that I'm using.
Zip File (113kb)
I'm not sure how else to code it. Any help would be great, thanks!
-Alex
I just purchased BlitzPro3D a few hours ago and I'm lovin' it. Right now I'm trying to do some 2D animation and I'm having some trouble. I'm able to have it loop the correct animation when the left and right arrow keys are being pressed, but I also want to add a "standing" animation. I've sort of got it working, but the way I've coded it makes you see a quick flip of animation as it does the calculations for finding the right frame on the animation strip.
Here's the code and the two image filmstrips that I'm using.
Zip File (113kb)
Global elite, eliteframe=0, eliteframestand=0, tmrelite, dir=0, stand_dir=0 Graphics 640,480 SetBuffer BackBuffer() elite=LoadAnimImage("elite.jpg",240,201,0,12) elite_stand=LoadAnimImage("elite_standing.jpg",240,201,0,8) MaskImage elite,255,255,2 MaskImage elite_stand,255,255,2 elite_x=0 elite_y=240 elite_sp=3 While Not KeyHit(1) Color 255,255,255 Rect 0,0,800,600,1 If Not KeyDown(205) And dir = 0 Then timing_elite_stand() DrawImage elite_stand,elite_x,elite_y,eliteframestand EndIf If Not KeyDown(203) And dir = 6 Then timing_elite_stand() DrawImage elite_stand,elite_x,elite_y,eliteframestand EndIf If KeyDown(205) Then dir=0 timing_elite() elite_x = elite_x + elite_sp DrawImage elite,elite_x,elite_y,eliteframe EndIf If KeyDown(203) Then dir=6 timing_elite() elite_x = elite_x - elite_sp DrawImage elite,elite_x,elite_y,eliteframe EndIf ; DrawImage elite,elite_x,elite_y,eliteframe Flip Cls Wend End ; functions - controlling the timing Function timing_elite() If MilliSecs() > tmrelite + 100 Then tmrelite=MilliSecs() eliteframe=((eliteframe + 1) Mod 6) + dir End If End Function Function timing_elite_stand() If MilliSecs() > tmrelite + 120 Then tmrelite=MilliSecs() If dir = 6 Then stand_dir = 4 Else stand_dir = 0 End If eliteframestand=((eliteframestand + 1) Mod 4) + stand_dir End If End Function
I'm not sure how else to code it. Any help would be great, thanks!
-Alex