0 Favourites

How do I make a Platform Beat em Up Enemy Ai

  • Hy everyone, i need some help on creating a simple platform beat em up enemy ai...some simple codes or ideas..thank you.

  • 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?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Tutorial: Platform School
267 93,735
Megabeard's avatar
Megabeard
Unread hot topic
167 14,497
DMT2005's avatar
DMT2005
Unread sticky
1 Favourites
C2 Games made with CocoonIO
136 89,825
minhcuong's avatar
minhcuong