delay switching of frames? HELP

Blitz3D Forums/Blitz3D Beginners Area/delay switching of frames? HELP

Cp(Posted 2008) [#1]
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?


Yahfree(Posted 2008) [#2]
ms = 10 ;Milliseconds for delay
Delay ms


?


Cp(Posted 2008) [#3]
NoNo...
Not the delay command. I don't want to delay the program,I just want to make it switch frames slower.


Tab(Posted 2008) [#4]
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.


KillerX(Posted 2008) [#5]
Frame# = Frame + 0.1
Drawimage image,x,y,Floor#(Frame)

That should work.


Cp(Posted 2008) [#6]
Tab:Your solution might work.

KillerX:Clarification:Limiting how many frames of movement are displayed, and computing when to display them.


Cp(Posted 2008) [#7]
Thanks Tab! It worked!
YAAAAAY


Snarkbait(Posted 2008) [#8]
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.


Tab(Posted 2008) [#9]
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



Cp(Posted 2008) [#10]
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.


Shambler(Posted 2008) [#11]
If you don't use millisecs the animation will be slower or faster on other computers.


Cp(Posted 2008) [#12]
EDIT:Never mind, I tried millisecs again and it turns out I wasnt doing it right.sorry