Instance variable adjustment

Discussion and feedback on Construct 2

Post » Sat Dec 24, 2011 4:34 pm

The game is going good.

At the end of the level (20 minions dead) I put a boos a lot harder to kill, if you do so, you get your points and all that, but the tricky part is that killing the boss must update an instance variable called life, in order to make the minions a little more dificult.

This works only in the life span of the boss, every spwaned minion during the lifetime of the boss comes with the new variable but when you kill the boss they spawn with the initial life.

Any manual or link who can help me?

ArcaneBits

B
10
S
2
G
2
Posts: 68
Reputation: 2,273

Post » Sat Dec 24, 2011 4:38 pm

When you create objects, those objects are automatically picked.
Image Image
B
161
S
48
G
90
Posts: 7,350
Reputation: 66,755

Post » Sat Dec 24, 2011 4:44 pm

Sure, but the life variable goes back to the original value, does not keep spawning monsters with the new value asigned when i killed the boss.
B
10
S
2
G
2
Posts: 68
Reputation: 2,273

Post » Sat Dec 24, 2011 4:56 pm

So just use a global. Change the global when you spawn the boss. IE spite.value + global.value.
Image Image
B
161
S
48
G
90
Posts: 7,350
Reputation: 66,755

Post » Sat Dec 24, 2011 5:39 pm

Sounds nice to me, now, the exact question is how to i make that the SPAWN each every 3 seconds do the sprite.life=golbal(updated)+sprite.life

I really apretiate your help, im kinda noob with Construct

Arcanebits
B
10
S
2
G
2
Posts: 68
Reputation: 2,273

Post » Sat Dec 24, 2011 6:02 pm

Not sure exactly what you mean, but what you described would look like:

+-global.value(canspawn)= 1
->every 3 seconds system create object sprite ant x,y
-->sprite set value life to sprite.value("life")+ global.value("life")

Thats with global.value("life") set to 0 initially.
When you create the boss set the global to the "updated" value, you can also change that value when you destroy the boss.
Image Image
B
161
S
48
G
90
Posts: 7,350
Reputation: 66,755

Post » Sat Dec 24, 2011 6:46 pm

You where right, just after killing the boss i managed to lvl-up the minions by updating the global and then after each new minion:

Value=Biencuidao.vida+Dificultad

Thanks
B
10
S
2
G
2
Posts: 68
Reputation: 2,273


Return to Construct 2 General

Who is online

Users browsing this forum: andreyin, Eisenhans and 13 guests