Tower Defence - this object [tower]

Get help using Construct 2

Post » Wed Jan 22, 2014 11:28 pm

hello i'v made this TD game:
*****://dl.dropboxusercontent.com/u/52790793/html5_games/Tower%20Defence%20vr%202.0/11.capx
[change the "*****" to "https"]

learn from the tutorials.

i have 1 problem, i'v made upgrade button - but when i'm using it, its upgrading all the towers and not only the one i choose.

how cani fix it?
B
3
Posts: 2
Reputation: 179

Post » Thu Jan 23, 2014 12:44 am

Yes, the way you have it setup right now, you are "picking" every tower to add the upgraded level to.

There's a few different ways to pick the correct tower you want to upgrade.

One suggestion would be to create an instance variable on the button object. Lets call it "TowerUID".

On line 3 where you spawn the upgrade button. set the TowerUID variable to "trt_basic.uid"

eg: (btnUpgrade - set value "TowerUID" to trt_basic.uid

This now lets the upgrade button know which tower it belongs to.

Next, down on line 28 where you have the upgrade logic....
You need to create a sub event that picks which tower to apply the upgrade to.

So add a sub event and use "Pick by evaluate" -> trt_basic (as the object) and in the evaluate line put trt_basic.uid = btnUpgrade.towerUID

Then for the action, move the 2 actions you have for the trt_basic (add 1 to level) and (set turret range), down to this new sub event, so that it only effects the "picked" turret.

B
82
S
39
G
15
Posts: 982
Reputation: 16,712

Post » Thu Jan 23, 2014 12:47 am

Pic
https://dl.dropboxusercontent.com/u/403350/towerlogic.png
B
82
S
39
G
15
Posts: 982
Reputation: 16,712

Post » Thu Jan 23, 2014 5:57 am

thanks!
B
3
Posts: 2
Reputation: 179


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests