Collision with particles

Hiya!

I'm making a top-down shooter and one of the weapons is a freeze gun. I've programmed the weapon using a particle system, but now I can't figure out if I can actually make collision events with particles generated by a particle system.

Is that even possible? Is so, how do I do it? Or is there another way for me to detect collision?

I was thinking of putting an almost invisible coneshaped object underneath the particles and make collision events with that object instead. But it wouldn't feel right in the game, I think, and it would be clunky to change later on.

Screenshot of the particles generated by the freeze cannon below.

Thanks in advance :)

particlecannon.png
 
Particle collisions are not possible (it's a part of why particles are much faster than instances). You could either create a triangular shaped instance that doesn't draw itself (add a blank code block into the Draw event for the triangle object) and align that with your player and their direction and base collisions off of that, or you could do use the point_in_triangle function and check whether your enemy instances are within it, applying damage if they are.
 
Particle collisions are not possible (it's a part of why particles are much faster than instances). You could either create a triangular shaped instance that doesn't draw itself (add a blank code block into the Draw event for the triangle object) and align that with your player and their direction and base collisions off of that, or you could do use the point_in_triangle function and check whether your enemy instances are within it, applying damage if they are.
Thank you for the fast reply.

I'll do as you suggest. Although not optimal, I think I can work with scaling a triangle/cone shape as the freezer cannon fires so it somwhat fits the particle bursts.
 
Yeah, just use the lengthdir functions to calculate the far corners of the triangle, with the appropriate angular offset, and increase the length up to a certain max (you could draw an actual triangle with draw_triangle using the same coordinates while you are testing so you can see it to get it to grow at the appropriate speed and cover the area you want).
 
I ended up making a sort-of particle system using instances instead. This way I can also make the alpha of the particles affect the damage and slow effects they do on the enemies hit. Works alright, now I just gotta make it as pretty as the particle system and hope that all those instances won't slow my game down too much. :)

particlecannon2.png
 
i was just going to say. although it may be bad practice i never use particles. all of my effects are made using instances. if i was going to create a freeze cannon like yours i too would have gone with objects.

what i would normally do for a freeze gun or smoke effect it lower the alpha by room speed and once the alpha gets to low then have the instance destroy itself. which looks like what you have going on i nthe screenshot above.
 
It's generally ok to use instances in place of particles when you need collisions. Just, as you've already said, keep an eye on FPS if you are streaming a lot of them (it shouldn't tank the FPS as modern computers are quite fast and can handle a lot of stuff, but you never know what else is going on in your game eating processing power and this sort of thing can end up being the straw that broke the camel's back).
 

Alexx

Member
Personally I would use point in triangle, and base the damage on the distance from the tank/turret.
 

Yal

🍋 *lemon noises*
GMC Elder
You could both eat the proverbial cake and still have it if you spawn (invisible) objects for the collision and have them create particles nearby rather than having the gun create all particles: you don't need so many objects, you can make things look pretty with a ton of particles, and the particles still are mostly accurate to where the attack happens.
 
Top