TD splash damage

  • Hi,

    how do i make a turret with splash damage instead of single bullet?

    thanks

  • When bullet hits, instead of applying damage to a single unit, pick units around bullet.x and bullet.y and apply damage to those instead.

    Use pick by comparison and compare distance(unit.x,unit.y,bullet.x,bullet.y) less or equal your_splash_radius

  • wow, let me try

    thanks

  • I want to do the same thing but even if I do a "Pick by comparison" it still only select the instance that was hit by the bullet.

    Can any of you post a code sample to show me how you achieved it, that would be really appreciated.

    Thanks a lot :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Bump. Have the same problem. Picking enemyes in splash distance doesnt work, idk why.

    Cant copy code, but:

    When bullet meets enemy, and system pick enemy where distance(Enemy.X,Enemy.Y,bullet2.X,bullet2.Y) less or eq than Bullet2.SplashRange

    Enemy - substract from healh

    Bullet2 - destroy.

  • I spawned a sprite, wich a circle, after bullet touches an enemy.

    And it should pick ALL enemies near it (by its radius) but it just attacks a single enemy and destroys.

    Sad story, is there anyone on this forum? :c

    Finaly made it.

    Spawned a circle, add a bullet behavior for it and as a single event set it "in collision with another object" - enemy - substract splash.damage from Health. And you need to set 0.1 or smt like that befor it destroys.

    Now it can work as a splash damage tower, and i gonna make one ice tower and once splash ice tower, it would be much easier.

  • Pick by evaluate would have been easier.

    On bullet collision with enemy

    +pick all enemy

    +pick enemy by evaluating distance(enemy.x, enemy.y, bullet.x, bullet.y) >= 50

    -> Do splash damages to picked enemies

  • Pick by evaluate would have been easier.

    On bullet collision with enemy

    +pick all enemy

    +pick enemy by evaluating distance(enemy.x, enemy.y, bullet.x, bullet.y) >= 50

    -> Do splash damages to picked enemies

    Thanks, but i cant make it work, lol.

    Im adding another condition - pick all enemies,

    Adding another - pick enemy by evaluating distance (with my parameters) and tower doesnt do damage.

    Funny is, when im toggle evaluating disabled, it attacks enemyes, but it kills random number of it, like 5 or 7, no matter what wave is it.

    But if i leave only evaluating - it doesnt work at all, bullet doesnt collides enemy, or smt.

    Can you, please, explain that and tell me when im wrong.

    Thanks again.

    Well i did it by myself, at 1st - picking is a sub event, and we need to pick enemyes wich in splash radius, so

    pick enemy by evaluating distance(enemy.x, enemy.y, bullet.x, bullet.y) <= bullet.SplashRadius

  • Care to share your capx ? It'll be easier to help you.

  • Care to share your capx ? It'll be easier to help you.

    Yeah, sure.

    Now im going to add some:

    Slow towers (splash slow too)

    Spear (going thru enemies for fixed distance, damaging collision),

    Chain lighting tower (thats the question).

    Critical strike - 20% chance to do double (or *x) damage.

    And something to sell towers and global map with lvls.

    Is there any TD discuss section?

  • Ah, I thought you had trouble getting it to work, but you indeed got it working pretty good. Just so you know, there was no need for the sub-event at line 35, you can put all those conditions under 34 and it will work too.

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