Reversing Animation
Blitz3D Forums/Blitz3D Programming/Reversing Animation
| ||
| okay, so now that I got the side step movement out of the way, I am now trying to make it look like Bob is back stepping.. to do so, I'd need to reverse the animation.. is this possible in Blitz, or will I need to make a new animation in custom? |
| ||
From Blitz3D documentation:Animate entity[,mode][,speed#][,sequence][,transition#] ... speed# - a negative speed will play the animation backwards. ... |
| ||
I must be doing the code all wrong then... =P
Graphics3D 640,480,16,2
SetBuffer BackBuffer()
AntiAlias enable
;----------
;load objects
camera=CreateCamera()
RotateEntity camera,45,0,0
light=CreateLight()
RotateEntity light,90,0,0
bob=LoadMD2( "bob.md2" )
RotateEntity bob,0,90,0
PositionEntity bob,0,-100,150
While Not KeyDown( 1 )
;----------
;movement
If KeyDown(200) Then
MoveEntity bob,1,0,0
EndIf
If KeyDown(208) Then
MoveEntity bob,-1,0,0
EndIf
If KeyDown(203) Then
TurnEntity bob,0,1.0,0
EndIf
If KeyDown(205) Then
TurnEntity bob,0,-1.0,0
EndIf
;----------
;animation (!!!!!!!!!!)
If Not KeyDown(200) Then
AnimateMD2 bob,1,0.1,9,1
EndIf
If Not KeyDown(208) Then
AnimateMD2 bob,1,-0.1,9,1
EndIf
;----------
;End Code
If bob=0 Then
RuntimeError "Failed to load bob!"
EndIf
UpdateWorld
RenderWorld
Flip
Wend
End
|
| ||
I dont understand why you write:If Not KeyDown(200) Then AnimateMD2 bob,1,0.1,9,1 Try this instead: ;---------- ;animation (!!!!!!!!!!) If KeyDown(200)=0 And KeyDown(208)=0 Then AnimateMD2 bob,0 If KeyHit(200) Then AnimateMD2 bob,1,0.1,1,9 EndIf If KeyHit(208) Then AnimateMD2 bob,1,-0.1,1,9 EndIf ;---------- ;End Code Understand that you have to use AnimateMD2 once to start or stop an animation, and if no key is pressed, stop it. If you call it every loop it will not work. |
| ||
| thanks.. and again, I'm still learning this stuff.. so I beg, please be patient with my slow learning type =P |