Difference between revisions of "B2.ParticleSystem"
Line 2: | Line 2: | ||
<languages /> | <languages /> | ||
<!-- GIDEROSOBJ:b2.ParticleSystem --> | <!-- GIDEROSOBJ:b2.ParticleSystem --> | ||
− | ''' | + | '''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> |
− | ''' | + | '''Available since:''' Gideros 2015.06.30<br/> |
− | === | + | |
− | + | === Description === | |
− | === | + | Defines particle system in box2d world using LiquidFun. |
− | '''Simple particle system example''' | + | |
− | <source lang="lua">-- create world | + | === Examples === |
+ | '''Simple particle system example''' | ||
+ | <source lang="lua"> | ||
+ | -- create world | ||
local world = b2.World.new(0, 9.8) | local world = b2.World.new(0, 9.8) | ||
− | local ps1= world:createParticleSystem({ radius=5}) | + | local ps1 = world:createParticleSystem({ radius=5}) |
ps1:setTexture(Texture.new("Bubble.png")) | ps1:setTexture(Texture.new("Bubble.png")) | ||
stage:addChild(ps1) | stage:addChild(ps1) | ||
− | ps1:createParticleGroup({shape=shape2, | + | ps1:createParticleGroup({shape=shape2, |
− | position={x=500,y=250}, | + | position={x=500,y=250}, |
− | color = 0xFF0000, | + | color = 0xFF0000, |
− | alpha=1, | + | alpha=1, |
− | flags=0 | + | flags=0 |
}) | }) | ||
ps1:createParticleGroup({shape=shape1, | ps1:createParticleGroup({shape=shape1, | ||
− | position={x=400,y=50}, | + | position={x=400,y=50}, |
− | color = 0x0000FF, | + | color = 0x0000FF, |
− | alpha=1, | + | alpha=1, |
− | flags=0 | + | flags=0 |
}) | }) | ||
− | |||
-- step the world and then update the position and rotation of sprites | -- step the world and then update the position and rotation of sprites | ||
Line 35: | Line 37: | ||
end | end | ||
− | stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)</source> | + | stage:addEventListener(Event.ENTER_FRAME, onEnterFrame) |
+ | </source> | ||
+ | |||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === | + | === Methods === |
[[Special:MyLanguage/b2.ParticleSystem:containsParticle|b2.ParticleSystem:containsParticle]] <br/><!-- GIDEROSMTD:b2.ParticleSystem:containsParticle(id) --> | [[Special:MyLanguage/b2.ParticleSystem:containsParticle|b2.ParticleSystem:containsParticle]] <br/><!-- GIDEROSMTD:b2.ParticleSystem:containsParticle(id) --> | ||
− | [[Special:MyLanguage/b2.ParticleSystem:createParticle|b2.ParticleSystem:createParticle]] '' | + | [[Special:MyLanguage/b2.ParticleSystem:createParticle|b2.ParticleSystem:createParticle]] ''create new particle''<br/><!-- GIDEROSMTD:b2.ParticleSystem:createParticle(particleDef) create new particle --> |
− | [[Special:MyLanguage/b2.ParticleSystem:createParticleGroup|b2.ParticleSystem:createParticleGroup]] '' | + | [[Special:MyLanguage/b2.ParticleSystem:createParticleGroup|b2.ParticleSystem:createParticleGroup]] ''create group of particles''<br/><!-- GIDEROSMTD:b2.ParticleSystem:createParticleGroup(particleGoupDef) create group of particles --> |
− | [[Special:MyLanguage/b2.ParticleSystem:destroyParticle|b2.ParticleSystem:destroyParticle]] '' | + | [[Special:MyLanguage/b2.ParticleSystem:destroyParticle|b2.ParticleSystem:destroyParticle]] ''destroy particle by id''<br/><!-- GIDEROSMTD:b2.ParticleSystem:destroyParticle(id) destroy particle by id --> |
[[Special:MyLanguage/b2.ParticleSystem:destroyParticles|b2.ParticleSystem:destroyParticles]] <br/><!-- GIDEROSMTD:b2.ParticleSystem:destroyParticles(ids) --> | [[Special:MyLanguage/b2.ParticleSystem:destroyParticles|b2.ParticleSystem:destroyParticles]] <br/><!-- GIDEROSMTD:b2.ParticleSystem:destroyParticles(ids) --> | ||
[[Special:MyLanguage/b2.ParticleSystem:getParticleCount|b2.ParticleSystem:getParticleCount]] <br/><!-- GIDEROSMTD:b2.ParticleSystem:getParticleCount() --> | [[Special:MyLanguage/b2.ParticleSystem:getParticleCount|b2.ParticleSystem:getParticleCount]] <br/><!-- GIDEROSMTD:b2.ParticleSystem:getParticleCount() --> | ||
[[Special:MyLanguage/b2.ParticleSystem:getParticleGroupList|b2.ParticleSystem:getParticleGroupList]] <br/><!-- GIDEROSMTD:b2.ParticleSystem:getParticleGroupList() --> | [[Special:MyLanguage/b2.ParticleSystem:getParticleGroupList|b2.ParticleSystem:getParticleGroupList]] <br/><!-- GIDEROSMTD:b2.ParticleSystem:getParticleGroupList() --> | ||
− | [[Special:MyLanguage/b2.ParticleSystem:setTexture|b2.ParticleSystem:setTexture]] '' | + | [[Special:MyLanguage/b2.ParticleSystem:setTexture|b2.ParticleSystem:setTexture]] ''set texture to particles''<br/><!-- GIDEROSMTD:b2.ParticleSystem:setTexture(texture,size) set texture to particles --> |
+ | |||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === | + | === Events === |
− | === | + | === Constants === |
[[Special:MyLanguage/b2.ParticleSystem.FLAG_COLOR_MIXING|b2.ParticleSystem.FLAG_COLOR_MIXING]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_COLOR_MIXING 256--> | [[Special:MyLanguage/b2.ParticleSystem.FLAG_COLOR_MIXING|b2.ParticleSystem.FLAG_COLOR_MIXING]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_COLOR_MIXING 256--> | ||
[[Special:MyLanguage/b2.ParticleSystem.FLAG_ELASTIC|b2.ParticleSystem.FLAG_ELASTIC]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_ELASTIC 16--> | [[Special:MyLanguage/b2.ParticleSystem.FLAG_ELASTIC|b2.ParticleSystem.FLAG_ELASTIC]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_ELASTIC 16--> | ||
Line 60: | Line 65: | ||
[[Special:MyLanguage/b2.ParticleSystem.FLAG_ZOMBIE|b2.ParticleSystem.FLAG_ZOMBIE]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_ZOMBIE 2--> | [[Special:MyLanguage/b2.ParticleSystem.FLAG_ZOMBIE|b2.ParticleSystem.FLAG_ZOMBIE]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_ZOMBIE 2--> | ||
|} | |} | ||
+ | |||
+ | ---- | ||
+ | *'''[[LiquidFun]]''' |
Revision as of 20:05, 17 February 2020
Supported platforms:
Available since: Gideros 2015.06.30
Description
Defines particle system in box2d world using LiquidFun.
Examples
Simple particle system example
-- create world
local world = b2.World.new(0, 9.8)
local ps1 = world:createParticleSystem({ radius=5})
ps1:setTexture(Texture.new("Bubble.png"))
stage:addChild(ps1)
ps1:createParticleGroup({shape=shape2,
position={x=500,y=250},
color = 0xFF0000,
alpha=1,
flags=0
})
ps1:createParticleGroup({shape=shape1,
position={x=400,y=50},
color = 0x0000FF,
alpha=1,
flags=0
})
-- step the world and then update the position and rotation of sprites
local function onEnterFrame()
world:step(1/60, 8, 3)
end
stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)
Methodsb2.ParticleSystem:containsParticle |
EventsConstantsb2.ParticleSystem.FLAG_COLOR_MIXING |