Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Bug with createParticle?
Started by Nicko77 Jun 03 2019 06:53 AM

1 reply to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Nicko77

[GLOBAL: userInfoPane.html]
Nicko77
  • Observer

  • 9 posts
  • Corona SDK

Hi all,

 

I created this code some time ago, and it used to work fine:

 

local particleSnow = physics.newParticleSystem(
    {
        filename = "Particle_1.png",
        density = 1,
        radius = 2,
        imageRadius = 4,
        maxCount = 2000,
    }
)
 

local Rand = math.random

 

        for i = 1, 500 do
            local velX = Rand(-500,500)
            local offsetX = Rand(-1080 + (1.5*i) , 1080 - (1.5*i))
            local offsetY = Rand(-1920 + (3*i) , 1920 - (3*i))
            local Snow =
                {
                flags = {"viscous", "tensile"},
                x = eX + offsetX,
                y = eY + offsetY,
                velocityX = velX,
                velocityY = -1000 + (i*0.5),
                lifetime = 1.5
                }
            local function snowTimer (event)
                particleSnow:createParticle (Snow)
            end
            timer.performWithDelay(2*i, snowTimer, 1)
        end

 

Since then I have updated my Corona SDK version and am currently running on Daily build: 2019:3473.

I did this in an attempt to resolve a different issue and noticed several improvements including correctly fading embossed text, so don't really want to downgrade again.

 

Is it an issue with the Corona build version? Or has something else changed? I've re-checked the documentation/guide and can't see any obvious issue with my code. The png file exists still, I get no errors or other feedback in the Console.

 

Any help greatly appreciated - thank you.

 

Nick

 

[/edit]

 

p.s.

 

I've turned on physics:setDrawMode("hybrid") and can see the particles in this mode, but they are completely invisible otherwise. Do I have to set an alpha for them somewhere now?

Attached Files



[TOPIC: post.html]
#2

Nicko77

[GLOBAL: userInfoPane.html]
Nicko77
  • Observer

  • 9 posts
  • Corona SDK

Ok I've sussed the problem, and it's not a bug with the particles.

 

Somewhere along the line I've expanded on my display groups, and my backgrounds although in the first display group are being rendered in front of my snow..!

 

As I can see no way to add the particleSystem to a group, I have found moving the local particleSnow declaration immediately before where createParticle is used circumvents the issue.

 

Silly me - it's taken me a couple of hours to suss this out...no bug report necessary after all thankfully..!




[topic_controls]
[/topic_controls]