How do I destroy bullet witch spawn form turrer?

  • Hi.

    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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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'.

  • thank you oosyrag and

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

    best regards.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)