Complete movement when hit, walk into walls

I would like to know if there is a way to do this:

A character plays the action “punch”, but when it hits another objetc it stops the action, but if it doesn’t, the action will be completed.

Also, is there a way to do the character walk into walls like in Prince of Persia?

Use the Acton actuator controlled by a property. Increase the property in every frame as long the animation should be played or it reaches the last frame.

The action actuator should be controlled by a keyboard and a property controllers? Excuse me, I don’t know much about using using propertys (almost nothing), how do I set up to do like you told me? Do I need phyton?

set up following:

add a property frame (int) start with 1.
add a property play (int) start with 0.

The property frame tells the actuator which frame to play. The property play is there to give you a better control of the animation. If play is not zero you increase frame and decrease play in every frame:

A) sens. prop. (play, not equal, 0)-> actuator prop (add, frame, 1) + actuator prop. (add, play, -1)

That means the properties will not change if play is zero (at start). Switch on your action actuator when required (playing the animation):
B) sens prop. (play, not equal, 0) -> actuator action (property, your_action, frame)

Ensure that your animation starts with the first frame:
C) sens. prop. (play, equal, 0) -> actuator prop. (assign, frame,1)

Start your animation by setting play to the number of frames to be played:
D) sensor keybord e.t.c -> actuator prop. (assign, play, 30)

When you enable debug on both properties you can see that play counts from 30 to 0 while frame counts from 1 to 31. Your animation plays the frame of the property frame. (If you count frame backwarts the animation is played reverse.)

To stop the animation stop the property frame to be counted. You can do that by adding a (collision) sensor to the logic bricks that counts the frame(A).

thanks monster, I will try to do that and give you some feedback…