animate comand
Blitz3D Forums/Blitz3D Beginners Area/animate comand
| ||
I am confused about the Animate and the keydown() comand here it is my first simple code with blitz3d While Not KeyHit(1) If KeyDown(57) Then Animate man,1 Else Animate man,0 EndIf UpdateWorld RenderWorld Flip Wend End I was expecting that the animation starts and keeps playing when I hold down the space bar and that it stops when I realese it but nothing happen, the animation remains still. the animation in .b3d format is ok and it has been loaded with the man = loadAnimMesh() comand Can you help me ? Thanks in advance |
| ||
the animate command starts an animation. so in this case it will start it again and again if you press enter. so you will always see the first frame only. once an animation is started, it will be updated by the UpdateWorld() Function, best called right before RenderWorld(). |
| ||
This code is actually working, you just can't see it working. ;) Anytime the animate command is used it starts the animation at the first frame,... what is happening in your example is that the code keeps resetting the animation to the first frame and does not advance beause it loops back to the first frame continually. edit: oops,... JFK beat me to it! Take a look at the SetAnimTime command as this will give you full control over the frame/speed of your animations. Otherwise, change your example to use keyhit instead of keydown, like this. If KeyHit(200) ;up arrow Animate man,1 EndIf If KeyHit(208) ;down arrow Animate man,0 EndIf hope that helps. |
| ||
or do a check for which animation is playing if keydown(200) if not animseq(man)= 1 Animate man,1 EndIf endif |
| ||
Switch% = 0 While Not KeyHit(1) If KeyDown(57) Then If Switch% = 0 Then Animate man,1 Switch% = 1 End If Else Animate man,0 switch% =0 EndIf UpdateWorld RenderWorld Flip Wend End |
| ||
Thanks all for your support Now it is clear |