Walk then attack function and animation

chuckdarockerchuckdarocker Member Posts: 3
edited November -1 in Working with GS (Mac)
How do I make 2 characters walk up to each other, pause as soon as they both collide, and then start attacking (punching) each other? I also would like this to be automatic and have seamless animation.
Thanks!

Comments

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Movement: Give the actors each a Change Velocity behavior so they can move towards each other.

    Each actor would then have the rule, when it receives event, collides with (the name of the other actor):
    -> Change Velocity to speed of 0, so they can stop.
    -> Animate (Their punching animation)
  • chuckdarockerchuckdarocker Member Posts: 3
    Thanks for the fast reply. I have a few more questions. How do I get the punching animation to effect the hit point of the actors? And how do I get the actor to start moving again once one of the actors is dead?
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    It may help to know what your game is going to do. It sounds like some kind of tower defense game.

    Brainstorm:
    What you could do is setup some invisible actors to act as short range detectors and event senders.

    Each time your actor throws a punch, you can spawn one of the invisible actors in front of it to collide with the opponent. When the opponent collides with the invisible actor, it takes the specified amount of damage as set in the rule that check the collision with that invisible actor. That actor is destroyed when it collides with another actor.

    When the opponent takes enough damage, it can send a different actor ahead of it signifying that the path is clear to continue moving. When your actor collides with that invisible actor, it changes its move state to moving again.
Sign In or Register to comment.