Well I got it to work! Thanks guys! :)
I used a combination of select case and a flag. Here is what I did:
This code properly displays the idle animation when the key isn't being held and properly loops the animation when the key is held down! Yay!
I used a combination of select case and a flag. Here is what I did:
Graphics3D 800, 600 SetBuffer BackBuffer() camera = CreateCamera() CameraViewport camera, 0, 0, 800, 600 light = CreateLight() Global man = LoadAnimMesh("walking_man.3DS") Global walking = ExtractAnimSeq(man, 0, 10) Global idle = ExtractAnimSeq(man, 5, 5) Global speed = 1 sequence = 0 flag = 0 PositionEntity man, 0, 0, 400 RotateEntity man, -45, 0, 0 While Not KeyHit(1) If KeyDown(31) sequence = 1 Else sequence = 2 EndIf Select sequence Case 1 If sequence = 1 And flag = 0 Walking_Anim() flag = 1 EndIf Case 2 If sequence = 2 Idle_Anim() flag = 0 EndIf End Select UpdateWorld RenderWorld Flip Wend End Function Walking_Anim() Animate man, 2, speed, walking End Function Function Idle_Anim() Animate man, 1, speed, idle End Function
This code properly displays the idle animation when the key isn't being held and properly loops the animation when the key is held down! Yay!