delay switching of frames? HELP
Blitz3D Forums/Blitz3D Beginners Area/delay switching of frames? HELP
| ||
Ok, I have some code for frames, but I don't know how to delay switching them.It goes really fast and doesn't look right. The type of frame animation I have is a person that can face 4 dirs. and for each dir, 2 frames.8 frames total in the image. So how do I delay the frames from switching? |
| ||
ms = 10 ;Milliseconds for delay Delay ms ? |
| ||
NoNo... Not the delay command. I don't want to delay the program,I just want to make it switch frames slower. |
| ||
Select Anim Case 0 ; Idle MinFrame = 0 MaxFrame = 4 AnimSpeed = 8 ; Animation speed end select EntityTexture Ent,Tex,CurrFrame,0 ; Drawimage image,x,y,CurrFrame AnimSpeedCnt = AnimSpeedCnt + 1 If AnimSpeedCnt > AnimSpeed If CurrFrame >= MaxFrame CurrFrame = MinFrame Else CurrFrame = CurrFrame + 1 EndIf AnimSpeedCnt = 0 EndIf Also you can use millisecs if you want. |
| ||
Frame# = Frame + 0.1 Drawimage image,x,y,Floor#(Frame) That should work. |
| ||
Tab:Your solution might work. KillerX:Clarification:Limiting how many frames of movement are displayed, and computing when to display them. |
| ||
Thanks Tab! It worked! YAAAAAY |
| ||
use millisecs, that way it will be the same on any computer. take the starting millisecs, then check another variable against it every loop until it's whatever duration you want, then change the animation frame, and reset the start millisecs. |
| ||
With millisecs()AnimSpeedCnt = Millisecs() Select Anim Case 0 ; Idle MinFrame = 0 MaxFrame = 4 AnimSpeed = 1000 ; Animation speed end select EntityTexture Ent,Tex,CurrFrame,0 ; Drawimage image,x,y,CurrFrame If AnimSpeedCnt > Time + AnimSpeed Time = Millisecs() If CurrFrame >= MaxFrame CurrFrame = MinFrame Else CurrFrame = CurrFrame + 1 EndIf EndIf |
| ||
I'm not going to be using millisecs.I already tried that, thats part of the reason I asked for help.Cuz that didn't work. |
| ||
If you don't use millisecs the animation will be slower or faster on other computers. |
| ||
EDIT:Never mind, I tried millisecs again and it turns out I wasnt doing it right.sorry |