I have a map built that is very large. I am trying to integrate the particle candy product into the map to add smoke and fire in places. The problem that I am trying to fix is that the objects in particle candy are place by relative position to the screen, not the absolute position on the map.
I have objects setup as Spawn points for the effects, I just need to be able to convert their world coordinates to relative screen coordinates. I see conversion utilities to go the other way, but nothing that would help me bring it back.
I grab my objects
-- Load the map
local map = lime.loadMap("Chapter 1.tmx")
local objectlayer = map:getObjectLayer("Player Objects")
local stack1 = objectlayer:getObject("Nuclear Stack 1")
local stack2 = objectlayer:getObject("Nuclear Stack 2")
local stack3 = objectlayer:getObject("Nuclear Stack 3")
Then I create my emitters
-- CREATE AN EMITTER (NAME, SCREENW, SCREENH, ROTATION, ISVISIBLE, LOOP)
Particles.CreateEmitter("Smoke1" , stack1.x, stack1.y, 0, true, true)
Particles.CreateEmitter("Smoke2" , stack2.x, stack2.y, 0, true, true)
Particles.CreateEmitter("Smoke3" , stack3.x, stack3.y, 0, true, true)
Particles.CreateParticleType ("SmokeParticles1", Properties)
Particles.CreateParticleType ("SmokeParticles2", Properties)
Particles.CreateParticleType ("SmokeParticles3", Properties)
-- FEED EMITTERS (EMITTER NAME, PARTICLE TYPE NAME, EMISSION RATE, DURATION, DELAY)
Particles.AttachParticleType("Smoke1" , "SmokeParticles1", 2, 9999, 0)
Particles.AttachParticleType("Smoke2" , "SmokeParticles2", 2, 9999, 0)
Particles.AttachParticleType("Smoke3" , "SmokeParticles3", 2, 9999, 0)
-- TRIGGER THE EMITTERS
Particles.StartEmitter("Smoke1")
Particles.StartEmitter("Smoke2")
Particles.StartEmitter("Smoke3")
So for example, my stack1.x is 8000 and my stack1.y is 55. I am able to start the Emitters in the right place as you enter the Frame, but as soon as I move to the right, the emitters stay at screen.x + 8000 always keeping them out of view.
I was going to update the emitters location based on the screen movement and then disable the emitters once the level is complete.
Any ideas would be appreciated. I know this looks like a Particle Candy question, but it is really about understanding where objects are relative to the viewable screen. [import]uid: 32632 topic_id: 6865 reply_id: 306865[/import]