Destroy after animation

0 favourites
From the Asset Store
4 Block Soldiers with different animations, 400x400
  • Hey all,

    I am workinj on ninja endless runner game.

    I already got my ninja running and jumping and I get the blocks and enemies created randomly on random distance and stuff. So the fact that the enemie jumps from one block to another and tries to attack my ninja n stuff.

    Now what I want to do is:

    1. When ninja punches the enemy - enemy destroy animation plays - enemy dies.

    2. When enemy punches ninja - ninja destroy animation plays - ninja dies - layer restarts.

    Everything is working but sometimes the destroy animation plays and ninja keeps running, or enemy keeps running.

    I tried to destroy the character on animation playing or on 'punch button' pressed or down, nothing works perfectly.

    Maybe the problem is that my enemy appears randomly and there might be two or three same enemies on screen at the same time, I dont know.

    Let me know what might be the problem I can post screenshots too

  • Post your capx via dropbox or other file host or image of your code (events) and we can probably sort it out quick.. you will have to put spaces in the link to post it here due to your rank.. (ie. w w w .my file etc).

  • Can you take a screenshot of the Event Sheet that triggers the Death Animation and the Character/Enemy being Destroyed?

  • Hey thanks for trying to help!

    here is the link to the project:

    www(dot)dropbox(dot)com/s/tzdb88hk045qqrp/nin2.capx?dl=0

    Please if u change something let me know what exactly is changed so that i wouldn't make the same mistake again

  • Anyone?

  • The problem is, that your destroy-event is not triggered. The destroy-animation takes to long to be finished. The player is after a short time of the collision with the enemy back in the running-animation. So the destroy-animation never finished and your player will not be destroyed.

    With your enemy it's the same problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I understand. So what should I do?

  • You could give your player and enemy an instance variable like isDead and set if if in your collision events. And check in your events where you change animations, if isDead set to false.

  • Oh thanks. Will try

  • hey, i tried to do it, but nothing happens or maybe i don't understand what exactly should i do and the order of doing it. could you please correct it in my project or just print screen from my event sheet of what exactly should be done

  • I changed your cpax a little bit. I hope now it's a bit clearer.

    https://drive.google.com/file/d/0B5FlDY ... sp=sharing

    But there are still some flaws in it. For example, if you press s for attack, you will attack the whole time. I don't know what you're up to, If you want to stop if you attack or a new running attack animation ect. so it's your decision how to fix that.

  • i know my dude, look i am a newbie in this. just watched tons of videos and stuff.

    i dont know whether to attack on the button down or pressed

    i also don't know if "enemy destroy animation" should start playing on "s button" pressed or on the "stab animation" playing

    i am googling and searching all the time trying to change things but i cant really. there are many tutorials on how to create sprites and objects and bla bla bla, but when my player is running and jumping and i want to perfect this simple game, its hard to find those who shares ideas on how to polish games, you know? most of them dudes are keen on their enemies just disappearing and when the player dies they all just do the layer restart.

    my idea is to make this kind of endless runner game with my ninja jumping and killing enemies (there should be different types of enemies, like running, flying, crawling, shooting and bomb throwing enemies). and if u could help me with this stuff would be pretty awesome.

  • and thank you, yeah it's much clearer now my man! only thing is that my "flip jump" animation is not playing, maybe it's because the player is running and jumping at the same time. now trying different actions to fix that ha ha.

    its funny how u fixed everything with those variables...

  • The variables are some kind of states with them you can protect events, like the isDead event.

    I changed a litte more in the capx. I use a Timer-Event for the attack, so the states are automatically set back and now the player can only attack once per pressing the attack button. Also the attack animation will now break the jump animation, but it has still some flaws.

    https://drive.google.com/file/d/0B5FlDY ... sp=sharing

  • thanks bro! i really need ur full name so that i could credit u in case i ever finish it and share with people. but really if u re using variables for moving or jumping, why do we need events like IS JUMPING or IS RUNNING?

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