newb Q: particle demo help...

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
Xoria
Citizen
Posts: 61
Joined: Sun Jan 31, 2010 1:24 am

newb Q: particle demo help...

Post by Xoria »

To this, how can add a circle shape to this list of particle systems and make it appear when you click? Is that even possible? I really don't get how bodies work. Worlds are easy to get though, but still. Let me know if you need the full modded demo code.

Code: Select all

------1
   local p = love.graphics.newParticleSystem(part1, 1000)
   p:setEmissionRate(100)
   p:setSpeed(300, 400)
   p:setGravity(0)
   p:setSize(2, 1)
   p:setColor(255, 255, 255, 255, 58, 128, 255, 0)
   p:setPosition(400, 300)
   p:setLifetime(1)
   p:setParticleLife(1)
   p:setDirection(0)
   p:setSpread(360)
   p:setRadialAcceleration(-2000)
   p:setTangentialAcceleration(1000)
   p:stop()
   table.insert(systems, p)

-------2
   p = love.graphics.newParticleSystem(part1, 1000)
   p:setEmissionRate(200)
   p:setSpeed(0.001, 0.005)
   p:setSize(0.11, 0.13)
   p:setColor(255, 255, 255, 5, 255, 128, 128, 220)
   p:setPosition(400, 300)
   p:setLifetime(1)
   p:setParticleLife(2)
   p:setDirection(0)
   p:setSpread(360)
   p:setTangentialAcceleration(2000)
   p:setRadialAcceleration(-10)
   p:stop()
   table.insert(systems, p)    
Alex McKee
Prole
Posts: 1
Joined: Mon Feb 01, 2010 1:19 pm

Re: newb Q: particle demo help...

Post by Alex McKee »

There is a set of variables at the top of the main loop. For example:

Code: Select all

square = love.graphics.newImage("square.png")
To add a new type just create a plain, solid filled circle in a good drawing software such as Illustrator or Inkscape and export a PNG at 32px, which is the size of the others, or whichever size you want.

Put that image in the directory with the other PNG files and add an extra variable to the set.

Code: Select all

circle = love.graphics.newImage("circle.png")
Then create your new set with that circle variable.

Code: Select all

local p = love.graphics.newParticleSystem(circle, 1000)
To change the particle effects see the Particle system functions.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: newb Q: particle demo help...

Post by Robin »

Xoria wrote:I really don't get how bodies work. Worlds are easy to get though, but still.
Shapes, Bodies and Worlds have nothing to do with graphics, including particle systems. They are objects in the Box2D physics simulation.
Help us help you: attach a .love.
Xoria
Citizen
Posts: 61
Joined: Sun Jan 31, 2010 1:24 am

Re: newb Q: particle demo help...

Post by Xoria »

Appreciate the help.

Just wondering, can one enable particles to be effected by collision like bodies?
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: newb Q: particle demo help...

Post by Taehl »

You could always just put particle graphics on weightless physics bodies, for small-scale effects...
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+.
Xoria
Citizen
Posts: 61
Joined: Sun Jan 31, 2010 1:24 am

Re: newb Q: particle demo help...

Post by Xoria »

Right, but if I can't click to draw a body, then I might as well use particles in my case, right?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: newb Q: particle demo help...

Post by Robin »

Xoria wrote:Right, but if I can't click to draw a body, then I might as well use particles in my case, right?
Well, bodies only have a position, velocity, mass, ect, but no graphical representation. I'm not sure why you are even considering anything else than particles for a particle demo. ;)
Help us help you: attach a .love.
Xoria
Citizen
Posts: 61
Joined: Sun Jan 31, 2010 1:24 am

Re: newb Q: particle demo help...

Post by Xoria »

Good point lol. I'm using the particle demo as a start point for me to make a space like game w/ planets. A game like this requires a lot of particle effects and those bodies. I planed to make the planets by creating bodies, but it's easier to draw the particle way. (I want my game to feature mainly drawing), so what should I do for the planets?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: newb Q: particle demo help...

Post by Robin »

Well, Box2D is not fit for games set in space, so I'd say write your own collision checking.

It's what I do with my Space game: planets are just tables with x, y and a radius. Then, I iterate over all spaceships and calculate gravity and collisions.
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: No registered users and 228 guests