Colliding with particle

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

Colliding with particle

Post by tsturzl »

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?
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Colliding with particle

Post by Taehl »

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+.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Colliding with particle

Post by kikito »

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.
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

Re: Colliding with particle

Post by tsturzl »

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.
Lexsym
Prole
Posts: 15
Joined: Wed Sep 07, 2011 1:23 am

Re: Colliding with particle

Post by Lexsym »

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)?
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Colliding with particle

Post by nevon »

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)?
The problem is that you can't get the position of a particle.
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Colliding with particle

Post by Taehl »

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.
Why even bother with physics? Does your plasma push things around instead of just hurting them?

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+.
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

Re: Colliding with particle

Post by tsturzl »

The particle stream pushes the enemy, it doesn't injure them.
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Colliding with particle

Post by slime »

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.
User avatar
Fourex
Citizen
Posts: 53
Joined: Tue Nov 10, 2009 2:33 am
Location: Earth

Re: Colliding with particle

Post by Fourex »

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 :nyu:
Attachments
GeometricFlameThrower.love
Use space and the left mouse button.
(166.66 KiB) Downloaded 252 times
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests