Multiple enemies animation trigger

0 favourites
  • 6 posts
From the Asset Store
Ninja char for your game! Make your own Shinobi game with this art.
  • Hi Everyone!

    I’m on a platformer project actually and I encountering some several issues with animations and collision box.

    As you can see in the capx file , I create 2 different kind of enemies.

    The first one, named « Ghost », rise from the floor when the player object is getting too close to them. It is based on the range between the objects, if the player object is going far from an enemy, this one is hiding on the floor again.

    My main problem on this is getting the animation trigger available for all the enemies object. For now, it’s just working fine for one enemy. But it doesn’t work for multiple enemies on the same time (the 2 Ghost in the file)

    For the second kind of enemy called « Skullbat » as you can see, the flying animation only works for one enemy object. The second one is moving but don’t want to play the « Fly » animation and the collision box I have create doesn’t stick on the image point of the Skullbat.

    I think for both of the enemies class, the problem is the same.

    I try the « for each » condition but maybe it doesn’t work very well for this.

    If you guys know how to fix that I’ll be glad!

    Thanks!

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

  • mardoch here you go download

    i used line of sight... its easier then what u got there... which was a bit of to much spaghetti code... u can duplicate it and do the same thing for ghost also...

    i used r220

    Edited:updated the capx... sometimes before cause of the distance view was 500 or to large and the bats where to close to each other 1 of them was not rising up but flying in sleep mode... so i fixed that ... i updated the download link hope its what u wanted

  • Thanks , but the issue still persist. Even with your last update…

    When the player object is in the range (or the line of sight as you used) of the both enemies in the same time, only one is playing the right animation. The other one stay in "sleep" animation. Even if it's moving to the player's direction.

    Is there a way to activate the animation trigger for all of the enemies object?

    I thought the problem can be solved with the "for each" condition cause it's working fine with the collision box… but there is something strange with the animation. The condition is only working for only one object per time…

    Any idea?

  • see if this one works... it does on my side. ... Download 2

    the issue was the animation end was applying to all other objects even if the conditions where placed under each individual instance of the object... a weird logic thing ... but ehm... now it should be fine... not sure however about ur ghosts they look weird...

    but u can replicate the same thing for the ghosts or whatever it is ... hope it works for u ... gluck...

  • Yeah! That's working!

    Thanks so much !!

    So I have to deal with the instance to make the animations works fine! Gotta check that closer…

    About the ghosts, I know that they look pretty much like dead KKK guys …I also have to fix that!

    Thanks again!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah! That's working!

    Thanks so much !!

    So I have to deal with the instance to make the animations works fine! Gotta check that closer…

    About the ghosts, I know that they look pretty much like dead KKK guys …I also have to fix that!

    Thanks again!

    lol

    no problem, its not a big of a difference from what u initially did... instead of using the inRange variable u had created i made a new one that checks for the pre animation before flying and etc... that was the issue causing all other ones to play or get stuck ...

    u can also use the familly u got for ghosts and bats... and name their animations the same... and instead of using the skullbats object u use the famillyobject and that way u can incorporate in those 5 conditions all ur characters or monsters u want to add.. but u got to have the same animations name

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