cocos2d/cocos2d-x — Issue #687: Loading a particle plist file [lua]
Author: SegFaultAX
Created: 2012-01-26 23:23:04+00:00
State: open

We're trying to create a small demo app that uses @ciaranj's lua bindings for particleWithFile, but we can't seem to get it to load our custom particle designer plist. Here's the relevant snippet:

-- ... snip ...
local winSize = cocos2d.CCDirector:sharedDirector():getWinSize()
particleTexture = cocos2d.CCTextureCache:sharedTextureCache():addImage("particleTexture.png")
print("Particles created")

-- This part works as expected
particleExplosion = cocos2d.CCParticleExplosion:node()
particleExplosion:setPosition(cocos2d.CCPoint(winSize.width/2,winSize.height/2))
particleExplosion:setTexture(particleTexture)
layerGame:addChild(particleExplosion)
-- End First Effect

-- This doesn't do anything
particlesBG = cocos2d.CCParticleSystem:particleWithFile("testParticles.plist")
particlesBG:setTexture(particleTexture)
particlesBG:setPosition(cocos2d.CCPoint(winSize.width/2,winSize.height/2))
layerGame:addChild(particlesBG)
-- End Second Effect

print("Particles added")
initHUD(layerGame)
cocos2d.CCScheduler:sharedScheduler():scheduleScriptFunc("hellobox2d_tick", 0.016667, false)

-- ... snip ...

Note that there are 2 particles being added to the scene there. The ``CCParticleExplosion`` works as you might expect (a colorful blast of fading particles from the center of the screen). The second particle effect is just something we spit out of the designer for test purposes. Any help would be greatly appreciated.

Thank you for your hard work!