Hi, I need particles, which will be follow my object for a while… Something like “particle trail” when my object moving?
How can I do this?
Thanks. [import]uid: 59968 topic_id: 13479 reply_id: 313479[/import]
I didn’t wanna “roll my own” particle system, so I bought Particle Candy:
http://www.x-pressive.com/ParticleCandy_Corona/features.html
And they have an SetEmitterTarget function so I never had to worry about it. Your particle emitter just follows your object.
Hope it helps, and the library is TOTALLY worth it!
-Mario
[import]uid: 11636 topic_id: 13479 reply_id: 49563[/import]
Yes, I know about Particle candy, but I need only a few simple particles effects in my game so particle candy is useless for me…
I need only some basic code, how to make particles follow an object…
But if I will be need more complicated effects, I will buy a particle candy …
Thanks anyway
[import]uid: 59968 topic_id: 13479 reply_id: 49736[/import]
here’s the one
[lua]local physics = require “physics”
physics.start()
physics.setGravity(0,0)
local rect= display.newRect(0,0,320,5)
physics.addBody(rect,“static”)
local rect= display.newRect(0,475,320,5)
physics.addBody(rect,“static”)
local rect= display.newRect(0,0,5,480)
physics.addBody(rect,“static”)
local rect= display.newRect(315,0,5,480)
physics.addBody(rect,“static”)
local myObj = display.newCircle(100,100,5)
physics.addBody(myObj,{bounce = 0.5})
myObj:applyLinearImpulse( 100, 100, myObj.x, myObj.y )
local myParticles = {}
local myRandom = math.random
local function particleFollower()
for i=1,3 do
local circle = display.newCircle(0,0,1)
circle:setFillColor(myRandom(255),myRandom(255),myRandom(255))
circle.x = myObj.x
circle.y = myObj.y
local x1 = myObj.x + math.cos(myRandom(360)) * myRandom(5,10)
local y1 = myObj.y + math.cos(myRandom(360)) * myRandom(20,30)
transition.to(circle,{x = x1,y = y1,alpha = 0,time = 500,
onComplete = function() circle:removeSelf() circle = nil end })
myObj:toFront()
end
end
Runtime:addEventListener(“enterFrame”,particleFollower)[/lua]
[import]uid: 12482 topic_id: 13479 reply_id: 49754[/import]
@.hgvyas123
Wow!!! Simple, clean, efficient!! I like it! Thanks!
-Mario [import]uid: 11636 topic_id: 13479 reply_id: 49780[/import]
You are cool. I wish I could just “whip out” code like that and poof.
I’m such a programming noob it’s hilarious. I understand this code though, so for that I thank you.
I added it to my “tool box” hehe 
ng [import]uid: 61600 topic_id: 13479 reply_id: 49824[/import]
lol glad you liked it
[import]uid: 12482 topic_id: 13479 reply_id: 49852[/import]
Thanks, help me a lot! [import]uid: 59968 topic_id: 13479 reply_id: 49870[/import]
So i have this function that spawns an object and then a timer that runs through the function five times so it generates 5 of that object.
I put a particle emitting effect on the object which works quite well but when another object comes onto the screen, the particles from the first object stop and the particles continue on the newly appeared object.
How can i put the particle effect on all of the objects, even when they all are on the screen?
Thanks in advance [import]uid: 86598 topic_id: 13479 reply_id: 53373[/import]
I think my particle system can do this but haven’t tried it. how long do u need it to follow [import]uid: 7911 topic_id: 13479 reply_id: 53388[/import]
Along these lines, I was trying to come up with a way to simulate an the sand in an hour glass. The solution I came up with created hundreds of 2px circles each with their own body. Needless to say, this wasn’t very elegant and the execution ran very slow. Any thoughts on how I could better code this? Thanks! [import]uid: 23185 topic_id: 13479 reply_id: 53392[/import]
i checked my system and it stops also but ill make some changes and try to get it to working [import]uid: 7911 topic_id: 13479 reply_id: 53399[/import]
ok i started working on this as soon as post #9 and after over thinking it for awhile and had give up right before post #11 then i figured i give it one more try and after about 3 minutes i think i got it thanks for pointing out this issue with particle systems its now a new feature i can add to the list of my particle system.
in my old video http://www.youtube.com/watch?v=pamhXrccqHc it show three particles running however the first moves straight from the right and them it was timed to end and the second one started moving in a circle then the scene changes and it show the third. now with the new particle system the first doesnt end before the next starts although not a visible difference cause of the timing i did in the old system but what is visible is i added another particle that is running at the same time as the second with a different image so it is visible.
what my system doesnt do afaik is work with physics, have not tried this yet, but i think the way i designed it you could simulate gravity in any direction
ill be selecting a few beta testers to run this and other things ( filesystem,highscore management, swipe detection, collision detection, and weighted random selection: so far, more to be added ), can email me @ (mynamehere)73@gmail.com [import]uid: 7911 topic_id: 13479 reply_id: 53411[/import]
ive uploaded a new video that show 2 different particles running at the same time. 1 the green cloud and 2 red dots
you can add as many new particles that you want however this does put a strain on the iphone but i have a built in system that you could set and by making a few other changes to the table you send to the system get good results the video is a bit choppy but thats due to the recording program not the system
http://www.youtube.com/watch?v=BBVh92fyemc [import]uid: 7911 topic_id: 13479 reply_id: 53418[/import]
soooo, how do you do it?
[import]uid: 86598 topic_id: 13479 reply_id: 53511[/import]