How do I destroy bullet witch spawn form turrer?

Get help using Construct 2

Post » Thu Apr 14, 2016 7:25 am


I have 4 different turret.

i use upgrade system for those , it means on time turret number1 become with 100 range and number2 with 200, for example.

but when i use "

Bullet >>> Bullet distance travelled >= tower.turret.Range ========> bullet >>> destroy

but in this case, bullet destroy on default range in tower.
so i use turetRange instance and update it with any tower upgrade, and use:

Bullet >>> Bullet distance travelled >= tower.turetRange ========> bullet >>> destroy

but it dose not work!

any idea please?

can i set turret range for each bullet witch spawn from a tower? and destroy with that?
Posts: 180
Reputation: 1,237

Post » Thu Apr 14, 2016 7:41 am

Sounds like a picking issue. Try adding the range variable to Bullet - Range. When you spawn bullet from tower, set Bullet.Range to Tower.Range

If Bullet Distance Travelled>Bullet.Range, Destroy Bullet.
Mistakes were made.
Posts: 1,964
Reputation: 75,430

Post » Thu Apr 14, 2016 7:58 am

Did you pick the right tower ? Using tower.turetRange is fine. It just needs to know wich tower.
Same for the bullets. You need a instance variable that identifys the bullet as shot with a particulair tower.
Then you have to pick the right bullet.

And it will not be an '=' comparing, but an '>" comparing.

But i am not sure if that is practicable. You can also use the expression > distance(bullet.x,bullet.y,tower.x,tower.y)

More about the picking:

First you need a for 'for each tower'. That will make the picklist contain one and only one tower.
Then comes a sub event that picks all the bullets shot by that tower. Since it is a subevent and it picks differend objects then the tower, it will add the bullets to the picklist. So now you have in that picklist one tower and all the bullets shot by that tower. Then comes a sub event under the last subevent ''bullet distance travelled' > 'd'. That is also in fact a pickcondition. Since it is a sub event, its takes the previous picked objects and filters them. So now in the picklist there is one tower and the bullets shot by that tower that traveld a distance biggeer then 'd'.
Posts: 2,493
Reputation: 21,450

Post » Thu Apr 14, 2016 8:05 am

thank you @oosyrag and @99Instances2Go.

with your way,i mix the both way, work very good.

best regards.
Posts: 180
Reputation: 1,237

Return to How do I....?

Who is online

Users browsing this forum: Tibolli and 4 guests