How to get this to work right

Blitz3D Forums/Blitz3D Programming/How to get this to work right

killertomato(Posted 2007) [#1]
OK, I'm trying to set this up so that when the character's animation sequence is being played, the character's animation flag is set to true, but when the animation is done playing, the flag switches back to false. While it does switch the flag on, I can't get it to switch back when the animation is done. This is the function I'm using:

Function Attack(Attacker.character,Attacked.character,Attack_Sequence,Range)

Attacker\anim_speed = 1

attacker\attacking = True

If attacker\model
If AnimSeq(attacker\model) <> attack_sequence
Animate attacker\model,3,attacker\anim_speed,attack_sequence,1
attacked\HP = attacked\HP + attacked\armor - attacker\strength
Else
If AnimTime(attacker\model) >= AnimLength(attacker\model) Then attacker\attacking = False
EndIf
EndIf

End Function

Can anyone tell me what to do to get this to work right? Thanks in advance.


John Blackledge(Posted 2007) [#2]
Not necessarily relevant but watch out for animlengths of 30, which seems to be the default for old 3DS models, even though they contain NO anim frames!


GfK(Posted 2007) [#3]
Use Animating() (or it might be EntityAnimating()) to see if an entity is still animating.

I can't remember which is right, its been years since I used BB3D.