Colliding with particle
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Colliding with particle
I'm using Particles as ammunition in a game I'm creating, I'd like to check for collision with the particles in the system to see if they collide with the enemy. Can I do this? Is there a way to iterate through the system and get each particles x and y axis and size? Or is there any method of checking collision with a particle?
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: Colliding with particle
I don't think so. Why not make your own bullet system, where you store all the bullets to a table, then you can iterate through the table and check the collision via a simple distance check or something?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Colliding with particle
If I'm not mistaken, particle systems are meant to be used as visual effects only. You can't collide or interact with them in any way. You can only create them, update them, and that's it.
When I write def I mean function.
Re: Colliding with particle
Its not shooting bullets, its shooting plasma, kinda like a flame thrower.
I guess I'll just make a body in the physics world that underlays the particle stream and test for collisions on that body.
I guess I'll just make a body in the physics world that underlays the particle stream and test for collisions on that body.
Re: Colliding with particle
I'm new to love, but just thought I'd throw my two cents in: Couldn't you just create an invisible body and parent it to the particle (or just set the location of the body to that of the particle)?
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: Colliding with particle
The problem is that you can't get the position of a particle.Lexsym wrote:I'm new to love, but just thought I'd throw my two cents in: Couldn't you just create an invisible body and parent it to the particle (or just set the location of the body to that of the particle)?
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: Colliding with particle
Why even bother with physics? Does your plasma push things around instead of just hurting them?tsturzl wrote:Its not shooting bullets, its shooting plasma, kinda like a flame thrower.
I guess I'll just make a body in the physics world that underlays the particle stream and test for collisions on that body.
But it doesn't matter if it's plasma or bullets. You have a number of small, independently-moving and colliding circles. The only difference is the graphic you put on them (and maybe they move more slowly or something).
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Re: Colliding with particle
The particle stream pushes the enemy, it doesn't injure them.
- slime
- Solid Snayke
- Posts: 3166
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Colliding with particle
You'll have to create your own particle system if you want collision detection/physics, the built-in love ones don't support that kind of stuff besides gravity.
On the other hand, often visuals in games don't match up one-to-one with what's actually going on, and most people won't notice. You could make a custom thing to push things away, and then put the particle system on top of that.
On the other hand, often visuals in games don't match up one-to-one with what's actually going on, and most people won't notice. You could make a custom thing to push things away, and then put the particle system on top of that.
Re: Colliding with particle
This sounds EXACTLY like something I made a while ago. Feel free to use it as inspiration. You should remake it from scratch though, so you know the code and can edit it as you like.
EDIT: Just to be clear "use it as inspiration" means open it up and look at the code
EDIT: Just to be clear "use it as inspiration" means open it up and look at the code
- Attachments
-
- GeometricFlameThrower.love
- Use space and the left mouse button.
- (166.66 KiB) Downloaded 252 times
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 9 guests