0 Favourites

Platformer A.I multiple enemy animations?

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

    Download Capx:

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

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

    Hope this helps.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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.

    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.

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

    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.

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