Destroy after animation

Get help using Construct 2

Post » Thu Feb 18, 2016 9:30 pm

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
B
4
Posts: 10
Reputation: 224

Post » Fri Feb 19, 2016 12:07 am

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).
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
71
S
19
G
8
Posts: 640
Reputation: 9,701

Post » Fri Feb 19, 2016 12:36 am

Can you take a screenshot of the Event Sheet that triggers the Death Animation and the Character/Enemy being Destroyed?
*Insert Signature here*
B
13
S
5
Posts: 73
Reputation: 1,090

Post » Fri Feb 19, 2016 6:36 am

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
B
4
Posts: 10
Reputation: 224

Post » Sat Feb 20, 2016 8:33 am

Anyone?
B
4
Posts: 10
Reputation: 224

Post » Sat Feb 20, 2016 9:37 am

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.
B
24
S
3
G
1
Posts: 454
Reputation: 2,171

Post » Sat Feb 20, 2016 2:21 pm

I understand. So what should I do?
B
4
Posts: 10
Reputation: 224

Post » Sat Feb 20, 2016 3:40 pm

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.
B
24
S
3
G
1
Posts: 454
Reputation: 2,171

Post » Sat Feb 20, 2016 4:11 pm

Oh thanks. Will try
B
4
Posts: 10
Reputation: 224

Post » Mon Feb 22, 2016 7:50 am

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 :-(
B
4
Posts: 10
Reputation: 224

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 31 guests