How do I make a Platform Beat em Up Enemy Ai

Get help using Construct 2

Post » Thu Nov 05, 2015 8:18 am

Hy everyone, i need some help on creating a simple platform beat em up enemy ai...some simple codes or ideas..thank you.
B
6
S
1
Posts: 35
Reputation: 476

Post » Thu Nov 05, 2015 11:40 am

What should the enemy do?
When should the enemy do it?
What behaviour are you using for player and enemy?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Nov 05, 2015 2:31 pm

:) 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
B
6
S
1
Posts: 35
Reputation: 476

Post » Thu Nov 05, 2015 2:47 pm

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)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Nov 05, 2015 5:16 pm

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.
B
6
S
1
Posts: 35
Reputation: 476

Post » Thu Nov 05, 2015 5:27 pm

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Nov 05, 2015 5:49 pm

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..
B
6
S
1
Posts: 35
Reputation: 476

Post » Thu Nov 05, 2015 6:04 pm

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Nov 05, 2015 7:05 pm

How can i share the capx here?
B
6
S
1
Posts: 35
Reputation: 476

Post » Thu Nov 05, 2015 8:11 pm

Again..I don't know how to upload the capx file here for help...
B
6
S
1
Posts: 35
Reputation: 476

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 33 guests