I'm trying to create a sort of sim where you can launch fireworks and they explode and whatnot. I'm avoiding the particle system and physics modules entirely. I can't for the life of me figure out how to make my particles actually, like, fly out however. I really want to just avoid the modules Love provides just so that I can understand how they work better in general. I also like to handicap myself for whatever reason. Here is my current .love.
Edit:
Here is a pic if you don't know what I'm trying to achieve.
https://love2d.org/imgmirrur/82XH4CN.png
I want the particles to explode outward like that. Not how they just drop like they do now.
[Solved]How to create "explosions" no PS or Physics?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[Solved]How to create "explosions" no PS or Physics?
- Attachments
-
- fireworks.love
- (1.02 KiB) Downloaded 116 times
Last edited by AlexCalv on Sat Jul 04, 2015 7:39 am, edited 1 time in total.
Re: How to create "explosions" no PS or Physics?
Hey, you are on the right track. The change you need is this: When you spawn one of the small particles, you need to give it a random x- and y-velocity once. Then while it is flying do not use any randomness, but only physics.
Here are the lines you need to change:
(By the way you can leave away the "amount=amount" in the particle table.
And then also remove the randomness from the movement:
The next think, you can play with is some sort of damping/friction.
Here are the lines you need to change:
Code: Select all
function particles.Spawn(x, y, amount)
for i = 1, amount do
local xVel = love.math.randomNormal()*100
local yVel = love.math.randomNormal()*100
table.insert(particles, {x = x, y = y, xVel = xVel, yVel = yVel, amount = amount})
end
end
And then also remove the randomness from the movement:
Code: Select all
--v.xVel = v.xVel + love.math.random(-500, 500) * dt
Check out my blog on gamedev
Re: How to create "explosions" no PS or Physics?
Wow! Thank you so much! It really is just a wonder how you can overlook such simple things haha!micha wrote:Hey, you are on the right track. The change you need is this: When you spawn one of the small particles, you need to give it a random x- and y-velocity once. Then while it is flying do not use any randomness, but only physics.
Here are the lines you need to change:(By the way you can leave away the "amount=amount" in the particle table.Code: Select all
function particles.Spawn(x, y, amount) for i = 1, amount do local xVel = love.math.randomNormal()*100 local yVel = love.math.randomNormal()*100 table.insert(particles, {x = x, y = y, xVel = xVel, yVel = yVel, amount = amount}) end end
And then also remove the randomness from the movement:The next think, you can play with is some sort of damping/friction.Code: Select all
--v.xVel = v.xVel + love.math.random(-500, 500) * dt
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 53 guests