Multiply Scores from destroyed instances

Get help using Construct 2

Post » Mon Feb 11, 2013 7:30 am

Hello!, i'm looking a simple solution

If a instance is destroyed, added 100 to variable

If 2 instances are destroyed, multiply the scores to variable like 400

Basically:

1 destroyed instance = 100
2 destroyed instances = 400
3 destroyed instances = 900

Do you have an idea how to implement?

Thanks!
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Mon Feb 11, 2013 7:38 am

Global variable InstancesDestroyed (or scoreMultiplier, which ever is the fitting)

->On object destroyed: increment variable
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Mon Feb 11, 2013 8:16 am

@vee41 but that's basic, i already implemented that, i'm looking a solution when you destroy an instance, you get 100 points, it's basic, but if you destroy 2 instances in same time, you get bonus points like 400 points.

Do you know what i mean?
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Mon Feb 11, 2013 8:20 am

Oh, so it would be like multikill or killstreak? Set a timer that resets the multiplier if you don't make a kill in certain time.
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Mon Feb 11, 2013 8:29 am

@vee41

Im creating scores for puzzle game, i don't think it needs a timer, it could affect destroyed blocks in chain way.
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Mon Feb 11, 2013 8:46 am

I edited my old example a bit, here is an example how you could do it:

Matcher demo
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Mon Feb 11, 2013 9:13 am

Global variable:
var score = 0;      // Player's score.
var multiply = 1.0; // Multiply rate for score.
var destCount = 0; // How many objects were destroyed just now?

Instance variable for the object:
var score = 100;    // Default score if only destroyed 1 in a row.

Every tick:
multiply = destCount^2

For each object:
----If (Object was destroyed)
-------{+1 to destCount; +(object.score*multiply) to global score; destCount = 0;}

Haven't try yet but hope this would help~ ^_^
B
13
S
5
G
3
Posts: 63
Reputation: 3,989


Return to How do I....?

Who is online

Users browsing this forum: randomly, Walessio and 23 guests