Platformer A.I multiple enemy animations?

Get help using Construct 2

Post » Wed Jul 27, 2016 10:36 pm

Hello all, I recently been working on some A.I for a Vania style platformer in Construct 2. I have seem to hit a brick wall trying to sync the enemy attack animations with a instance variable(attackCD) from the enemy collision box. I try'd things like "trigger once while true","for each" and even giving the Slime sprite its own instance variables. I can't seem to figure it out, try'd many combinations of events. I could use a bit of help and knowledge here.

Atm if you agro just one of the slimes, it acts just as I want it to. But when agroing multiple Slimes they stop the attack animations while the attack CD is still firing off.

I'll post some pictures and the capx file if anyone is intrested in helping out with it, would really appreciate it.

pics:
http://imgur.com/a/l7t8f
http://imgur.com/a/eCxNS

Download Capx: https://www.dropbox.com/s/qmsvwu5jgjer0 ... .capx?dl=0
Last edited by JasonS on Fri Jul 29, 2016 7:19 pm, edited 1 time in total.
B
13
S
4
Posts: 29
Reputation: 933

Post » Thu Jul 28, 2016 7:42 pm

Pretty sure it's the "Trigger once" condition that's the problem here, try replacing it with something like "attack animation is not playing" so that it only triggers for slimes which aren't currently attacking.
B
54
S
24
G
18
Posts: 295
Reputation: 13,140

Post » Thu Jul 28, 2016 9:19 pm

Well, you made 3 calls to none existing animations. I moved them to the end and crossed them. Existing or not, they kick in.

The enemyes moved during attack, kicking the walk animation in.

And what Sup said. The attack is not looping. So either you loop it, and use trigger once. Or you got to loop it in the events as long as the attack_CD = 1.

Dont think the or blocks work that way. I think they make the Picklist (SOL) empty, so all the following sub conditions start from that empty SOL. The way i set them up, first the picking happens, then the evaluation.

https://www.dropbox.com/s/d4t81wey5vz29 ... .capx?dl=0

Hope this helps.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Jul 28, 2016 10:21 pm

99Instances2Go wrote:Well, you made 3 calls to none existing animations. I moved them to the end and crossed them. Existing or not, they kick in.

The enemyes moved during attack, kicking the walk animation in.

And what Sup said. The attack is not looping. So either you loop it, and use trigger once. Or you got to loop it in the events as long as the attack_CD = 1.

Dont think the or blocks work that way. I think they make the Picklist (SOL) empty, so all the following sub conditions start from that empty SOL. The way i set them up, first the picking happens, then the evaluation.

https://www.dropbox.com/s/d4t81wey5vz29 ... .capx?dl=0

Hope this helps.



Hello and thanks for the responses. I did try out your capx and I like some things but when u took away the "Trigger once while true" in there, the enemies lost the random cool down i had created for them from the instance variable "attack_CD", I wanted them to kinda attack as soon as they get to the player but also have the small random cooldown after the first attack, this was the real conflict i was having when I try'd taking out the "Trigger once while true". I feel like there is something simple here I cant see and not doing right.

I still need to figure this out. How to get the slimes to attack me as soon as they get near me and have a small random cooldown after the first attack.
B
13
S
4
Posts: 29
Reputation: 933

Post » Thu Jul 28, 2016 11:33 pm

Ah okay. I did't capture that cooldown. Well. You just need a timer to set that "attack_CD" to 0/1. Do not cooldown the animations. Cooldown the variable with random times.

https://www.scirra.com/manual/167/timer

Timers are private like instance variables. So on animation attack end, set "attack_CD" to zero, start a timer with a random time. On timer ... set "attack_CD" to 1.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 29 guests