Score system - bonus pickup/score

Get help using Construct 2

Post » Mon Jan 28, 2013 11:31 pm

Hi guys.

It is my first time posting here. I'm loving C2.

I have a simple question... I think. But I don't know how to go about and do it.

example
In bomb jack, the player has to collect the bombs to score.
However there is always one bomb that is lit. If you pick up that bomb you get a bonus and a new bomb turns on.


the bomb on the top left is lit.

How do I go about doing that? It can't be scripted I think because you have to take in consideration that some bombs might not exist already because the player collected them.

Any ideas?

Thanks a lot.
B
13
S
4
G
2
Posts: 20
Reputation: 2,517

Post » Mon Jan 28, 2013 11:37 pm

Boolean instance variable
.special = True or False

If Bomb.Special then
do special bomb stuff
else
do Regular bomb stuff
B
13
S
4
G
3
Posts: 75
Reputation: 3,425

Post » Mon Jan 28, 2013 11:45 pm

Thanks RangerJim,

I didn't explain myself well because I didn't want the post to be too long.

My doubt is more about how to attribute the "special" to a Bomb instance variable in a specific order, taking into consideration the bombs that might have been picked up already.knudle2013-01-28 23:45:51
B
13
S
4
G
2
Posts: 20
Reputation: 2,517

Post » Tue Jan 29, 2013 7:01 am

You could always pick a random bomb to have the special "lit" designation.
B
19
S
3
G
2
Posts: 148
Reputation: 1,945

Post » Tue Jan 29, 2013 7:06 am

Use the picking functions. Under system menu you'll find 'pick random instance' which would pick a single, random bomb. Or you could do it in more ordered fashion by using IID's and UID's.
B
24
S
8
G
7
Posts: 756
Reputation: 7,202

Post » Tue Jan 29, 2013 9:45 am

knudle
Give your bombs two instance variables
- number "order"
- boolean "activated"
Then assign a specific order for each of your bombs starting from 0

The event should look like that:[code]Global number currentBomb = 0
+ System: bomb.Count > 0
+ System: while
+ System: order != currentBomb
    -> add 1 to currentBomb

+ bomb: order = currentBomb
+ bomb: [invert] is activated
    -> bomb: set activated to true

+ bomb: is activated
    -> do things[/code]
!= means different
And be carefull this condition should really be a system event, not an object event (not object: order != currentBomb)
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Jan 29, 2013 3:00 pm

Thanks guys.

I will try Yann's method as I want to control the order of the bombs being lit.
B
13
S
4
G
2
Posts: 20
Reputation: 2,517


Return to How do I....?

Who is online

Users browsing this forum: Colludium, LaroTaio and 27 guests