TD splash damage

Get help using Construct 2

Post » Fri Nov 29, 2013 4:23 pm

Hi,

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

thanks
B
11
S
4
G
1
Posts: 15
Reputation: 1,332

Post » Fri Nov 29, 2013 6:45 pm

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
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Sat Nov 30, 2013 1:42 am

wow, let me try

thanks
B
11
S
4
G
1
Posts: 15
Reputation: 1,332

Post » Mon Feb 17, 2014 3:20 am

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 :)
B
19
S
5
G
4
Posts: 10
Reputation: 3,837

Post » Wed Dec 03, 2014 6:04 pm

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.
B
4
Posts: 7
Reputation: 214

Post » Fri Dec 05, 2014 6:34 pm

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.
B
4
Posts: 7
Reputation: 214

Post » Fri Dec 05, 2014 8:17 pm

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
B
71
S
30
G
25
Posts: 984
Reputation: 19,503

Post » Sat Dec 06, 2014 7:50 am

Magistross wrote: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
B
4
Posts: 7
Reputation: 214

Post » Sat Dec 06, 2014 8:15 am

Care to share your capx ? It'll be easier to help you.
B
71
S
30
G
25
Posts: 984
Reputation: 19,503

Post » Sat Dec 06, 2014 8:28 am

Magistross wrote: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?
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 7
Reputation: 214

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 31 guests