how to make an enemy attack

  • hi! i am working on a beat em' up game...

    now how do i make the enemy attack?

    i tried to set an animation when the enemy collision with the player,and it messed up with the graphics..

    i have a state2 var that set to idle,and in the animation i set the value to attacking...

    the movement needs to be a 4 direction.

    plz help me! thanks!

  • Very simple example just to explain the basics:

    Give the enemy a boolean variable attacking

    Player on collision with enemy

    Enemy set boolean attacking = true

    enemy is attacking

    set animation to attack

    else

    set animation to idle

  • ok thanks i will try it

  • It didn't worked can you give me an capx example for it?

    BTW I have two attacking animation one is strike1 and strike2

    I have used the choose function for these two

  • Could you be more specific?

    When you entered the above events..

    What happened and what did you expect to happen?

  • What happens is that the enemy runs through the player and does not attack..

    The attacking is playing only when the enemy is half way inside the player...

    I want a line of sight function that will play the animation of the two types of attacking and also will run in a 4 direction toward the player,the enemy needs to follow the player...

    The enemy needs to be mirrored too...

    Thanks

  • You asked for attacking on collision..

    You never said the enemy moved towards the player..

    Mirroring the enemy should be pretty easy based on if the enemy is moving left or right (which would be based on the position of the player I guess)..

    Without an example of what you have done so far, the answers you get are based on what we think you are doing..

    I'm not sure what you mean by a line of sight function playing an animation..

    Also the four direction part throws me a bit of, what if the player is at a different angle from the 4 directions the enemy is able to move?

  • there's my event sheet

    if you can help me fix the event sheet..

  • Plz help!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • help

  • If you could explain what you want in a better way it would be much easier to help..

    You said the event I gave you didn't work, but it did..

    It played the animation attack on collision with the player..

    when event 3 is true, however, event 22 or 23 is probably still true also, so the actions attached to that will perform..

  • Beat'em ups can be very tricky, especially on the AI side. If you are willing to invest in your game check this two:

    Classic Beat'em up: https://www.scirra.com/store/royalty-free-game-templates/beatem-up-2d-scrolling-1134

    Platformer beat'em up: https://www.scirra.com/store/royalty-free-game-templates/beatem-up-platformer-687

  • but in there i have to buy it from you...

    i want a free toturial..

    anyway i think i will buy it...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)