How do I make a Platform Beat em Up Enemy Ai

0 favourites
  • 11 posts
From the Asset Store
A pack of 76 platform designs for a platformer game with a mushroom/jungle theme
  • Hy everyone, i need some help on creating a simple platform beat em up enemy ai...some simple codes or ideas..thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What should the enemy do?

    When should the enemy do it?

    What behaviour are you using for player and enemy?

  • well something like in old school beat em ups..follow the player ( but not constantly ), when close - attack ( but not constantly )..when hurt - flee..something like this. Thank you.

    PS: I use the platform behaviour

  • So when should the enemy follow the player and when not?

    (what are the conditions?)

    When should the enemy attack and when not?

    Being close could be checked with distance(enemy.x,enemy.y,player.x,player.y) < Whatever amount of pixels you like..

    If you only want to check in the horizontally abs(enemy.x-player.x) should do the trick..

    Fleeing when hurt could be done by giving the enemy a boolean variable "Hurt" and setting it to true when hurt..

    Adding the condition enemy is not hurt to your attack and follow events and adding an event what to do when enemy is hurt.

    It's all about telling the computer when to execute certain actions (when all conditions are met)

  • It's good so far, the only thing that doesn't work is the enemy's hp. When i hit the enemy a hp bar shows up and reduces in width but when hp<=0 the bar starts to fill up ( reverts it's width ) and the enemy doesn't get destroyed. If i don't give any AI to enemy this thing with hp works perfectly..i can't figure out what have i made wrong.. Thanks again.

  • What are the events concerning the hp and the bar?

    I don't think they should be affected by ai unless you have some conflicting events..

  • Well, i made some collision events when the player is on collission with enemy and player is attacking, the enemy should change into hurt animation, substract certain amount of hp and the hp bar change width according to enemy.hp..i made these events before i aded AI to enemy and it worked, after that, when i made some kind of finite states ( state 1 - walk right, state 2 - walk left, 3 - attack, 4 - hurt ), each state triggered on certain conditions ( dist. to player and so on..) it didn't work anymore..

  • So it seems you have created conflicting events..

    Events that are true when other events are also true overwriting certain actions you still want to happen..

    Without seeing the events themselves it would be wild guessing..

    Either look at your events and try to figure out why they conflict with the events you had, or share them here so we can have a look..

  • How can i share the capx here?

  • Again..I don't know how to upload the capx file here for help...

  • upload the capx to any site (either your own or something like dropbox or another filesharing site) and post the link to it here..

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