Score with Multiplier

Get help using Construct 2

Post » Mon Aug 05, 2013 7:42 pm

I'm designing a score system that has a bonus multiplier if you kill enemies within a certain time period. Here's the code I'm using:



The issue I'm having is that sometimes enemies are killed at the same time, but it's only registering as 1 enemy. I can't do "on Enemies Destroyed" because each enemy has it's own death animation.

Any idea why it's doing this?
B
29
S
7
G
1
Posts: 492
Reputation: 3,292

Post » Tue Aug 06, 2013 2:04 am

Maybe this will help? It's a tutorial I did a while back on creating a multiplier over time.

http://www.youtube.com/watch?v=ozymgAuiQ3I
B
100
S
31
G
11
Posts: 1,552
Reputation: 21,502

Post » Tue Aug 06, 2013 4:21 am

@ArcadEd - thanks for the link. It's helpful, but unfortunately doesn't solve my problem. Since multiple instances of Health < 0 on the same tick, it's somehow considering all of those as the same instance and increasing the ComboX by only 1 instead of the appropriate amount.
B
29
S
7
G
1
Posts: 492
Reputation: 3,292

Post » Tue Aug 06, 2013 9:00 am

UPDATE: I've attempted to change the health <_ 0 to "on destroyed" with a specific sprite instead of a family, and it seems to have worked, but I would then have to re-code every enemy's death to destroy the object and create a "death animation" object on the destroyed object (on top of having lines of code for each enemy's score multiplier).

This kind of feels like a backwards way of doing this...does anyone have any insight on this?
B
29
S
7
G
1
Posts: 492
Reputation: 3,292

Post » Tue Aug 06, 2013 9:07 am

[QUOTE=ome6a1717]I can't do "on Enemies Destroyed" because each enemy has it's own death animation.
[/QUOTE]

Why, what is preventing you?
B
24
S
9
G
7
Posts: 756
Reputation: 7,292

Post » Tue Aug 06, 2013 4:44 pm

@vee41 - Hey Vee, the objects aren't destroyed until the end of the animation, so there is a delay on the combo, as well as using a family for this creates a strange result of the comboX variable to increase indefinitely upon killing the first enemy.
B
29
S
7
G
1
Posts: 492
Reputation: 3,292

Post » Wed Aug 07, 2013 8:43 am

[QUOTE=ome6a1717] Hey Vee, the objects aren't destroyed until the end of the animation, so there is a delay on the combo, as well as using a family for this creates a strange result of the comboX variable to increase indefinitely upon killing the first enemy.[/QUOTE]

You could get rid of for each and increase comboX with enemies.pickedcount instead of one. I'd probably tie increasing the comboX to the start of death animation too. :)
B
24
S
9
G
7
Posts: 756
Reputation: 7,292

Post » Wed Aug 07, 2013 11:12 pm

Hey Vee,

I ended up just adding a enemydeath sprite that contains enemy deaths and using the "on destroyed" trigger for the enemies which seemed to have worked. Here's hoping it won't shoot me in the foot later!

Thanks for you guys' help!
B
29
S
7
G
1
Posts: 492
Reputation: 3,292


Return to How do I....?

Who is online

Users browsing this forum: BackendFreak, JaisonAntoniazzi, Yahoo [Bot] and 8 guests