delaying attack logic until the attack animation finishes?

hi. i got a little question on delaying an action in logic brick…
i made a attack animation and set it to play it when i press left mouse button!
so, when i tap the left mouse button, then it triggers the attack animation and setting attacking properties and crap.
but i want to make it not to be able to attack again until the animation finishes.
and i wonder how…to do it…

oh and another question, when i make a jump, in logic brick, like it moves 2.0 to z axis,
the character teleports to the air then falls down. i want to make it actually ‘jump’ to the air then fall down, not teleport to air then fall down.

any comment will be appreciated :yes:

When playing an animation in BGE using either an action or an ipo actuator, just add a property to your game object and set the “FrameProp” in the Actuator to this propertys name. The current frame of the animation will be stored in that property. Now add a property sensor to your “attack” controller that verifyes the animation has finished. To do this, you may set the property sensor from “Equal” mode to “Interval”, set the min and max values to the start frame and on lesser than end frame and set the “Inv” button. Connect this sensor to the controller that triggers the animation and so on.

For the second problem you may make your charakter a dynamic or rigid body object, use the simplme motion actuator and set the z-value for “force” instead of “location”. Additionaly you may add a sensor checking ground contact so that your character only is able to jump if he stands on the ground.

Thank you soooo much, brother!!(or sister)
it’s really helpful!!

================
i got a little problem with this method.
when press the attack button while it’s playing the attack animation, then the attack animation stops…

I think that’s because the activated the mouse sensor combined with the property sensors during the action results in a negative pulse and stops the animation. Try setting the animations playback type to ‘play end’.

Alternatively try using states, where the mouse click triggers a state actuator switching to a new state with the property sensors hooked up to another state actuator and an always sensor connected to the action actuator. The mouse sensors wouldn’t be hooked up in this state so will have no effect on the playback, then when the property sensor triggers to say the animation is complete it triggers the other state actuator switching back to the first state.

Hope this helps!