Platformer A.I multiple enemy animations?

0 favourites
  • 5 posts
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • 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

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

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

    Hope this helps.

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

  • Try Construct 3

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

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

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