@Sphere Game Studios, Thanks
But I do not think it’s okay as confetti get out of the screen and then delete it with your code in the end there would be a lot of problems …
Just add static objects on the boundary and use collision to remove confetti that goes off screen.
@Sphere Game Studio
Are you saying that the number of articles can start to cost alot even if the sprite sizes are small?
My tests so far has shown that sprite size is what cost.
The only way I see that happening is using a really high number, perhaps in the thousands, on a relative small screen area.
In such a case a sprite animation is probably more efficient, though seldom as nice.
Of course, as always when making anything for the mobile platforms, optimizing effect parameters is mandatory.
A sun can use both 50 and 250 particles and still look more or less the same.
Anaqim
Yes, number of particles can really drag performance if you have hundreds of them.
There are two main limitations… Size of graphics and number of graphics. You can hit a limit on one or the other or both.
Corona simply sends a list of instructions and textures to the GPU. Obviously the longer the list the slower this will run.
An easy win is less particles but larger texture.
Thanks for the tip
Have a great day!
Anaqim
Thank you but the problem was not the elimination of confetti out of screen, rather the fact that sooner or later the carrier will also contain less than 5 elements
Just make a check first something like this
if #confettis is less than 5 then X=#confettis, else X=5
then use for i=1, X do
Anaqim
or even use:
for i=1,math.min(#confettis,5) do
Anaqim
I’m trying this way
local function test() if(random(1,100) == 1) then local pos = random(1,#confettis) local hitX = confettis[pos].x+random(-opt.width\*.5, opt.width\*.5) local hitY = confettis[pos].y+random(-opt.height\*.5, opt.height\*.5) confettis[pos]:applyLinearImpulse( random(-1, 1), -1, hitX, hitY ) end end
However I can not give the effect of the video that is that of the image I attach. Where the movement is not linear. In the red circles the confetti make a rotation for the direction change and not a random rotation.
looks like perhaps you have gravity/physics on these confettis?
Yes, right