problems with floating objects (Tower Defence Game

Get help using Construct 2

Post » Fri Jul 19, 2013 5:01 am

Hi everyone,

I am new to Construct 2 and I encountered some problems while creating my own tower defence game using the example here. https://www.scirra.com/tutorials/443/building-a-tower-defence-game-with-the-turret-behaviour


It doesn't shoot when the player is placing the first turret. After placing the first turret, the rest of the turrets start shooting before you can even place them. I have downloaded the sample on the tutorial and it also has the same issue. Does anyone have any ideas how to solve the problem?
B
11
S
2
Posts: 22
Reputation: 778

Post » Fri Jul 19, 2013 6:29 am

I would set an instance variable on each turret like canShoot. Set it to default to false or no, and then when you set the turret down have that event set the canShoot instance variable for that turret to true. Adjust the shooting event and add a check for canShoot = true.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Fri Jul 19, 2013 6:33 am

The Add Turret target has been used incorrectly.

In the layout, for the ArrowTower, Disable the Initial state of the Turret behaviour. In event 8 (placement) add ArrowTower->Set Turret enabled. From event 19, copy the Add Turret target action and paste it to event 1 (On start of layout). Disable/remove event 19.

It's a subtle point, but the manual does mention that the Add Turret target need only be called once per object.

@GeometriX
@BluePhaze
blackhornet2013-07-19 06:47:24
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Fri Jul 19, 2013 12:29 pm

Thanks @Blackhornet and @BluePhaze for your solutions! It seems like Blackhornet's suggestion worked but I have to leave event 19 alone in order for the turret to acquire the target.
B
11
S
2
Posts: 22
Reputation: 778

Post » Fri Jul 19, 2013 1:40 pm

No, 19 is not needed:
Tower defence example_BHT
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Sat Jul 20, 2013 5:51 am

Yup, it works as well. Thanks Blackhornet!
B
11
S
2
Posts: 22
Reputation: 778


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 33 guests