Difference between revisions of "B2.ParticleSystem"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
<!-- GIDEROSOBJ:b2.ParticleSystem -->
 
'''<translate>Supported platforms</translate>:''' <br/>
 
'''<translate>Supported platforms</translate>:''' <br/>
 
'''<translate>Available since</translate>:''' Gideros 2015.06.30<br/>
 
'''<translate>Available since</translate>:''' Gideros 2015.06.30<br/>
Line 37: Line 38:
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Methods</translate> ===
 
=== <translate>Methods</translate> ===
[[Special:MyLanguage/b2.ParticleSystem:containsParticle|b2.ParticleSystem:containsParticle]] <br/>
+
[[Special:MyLanguage/b2.ParticleSystem:containsParticle|b2.ParticleSystem:containsParticle]] <br/><!-- GIDEROSMTD:b2.ParticleSystem:containsParticle -->
[[Special:MyLanguage/b2.ParticleSystem:createParticle|b2.ParticleSystem:createParticle]] ''<translate>create new particle</translate>''<br/>
+
[[Special:MyLanguage/b2.ParticleSystem:createParticle|b2.ParticleSystem:createParticle]] ''<translate>create new particle</translate>''<br/><!-- GIDEROSMTD:b2.ParticleSystem:createParticle -->
[[Special:MyLanguage/b2.ParticleSystem:createParticleGroup|b2.ParticleSystem:createParticleGroup]] ''<translate>create group of particles</translate>''<br/>
+
[[Special:MyLanguage/b2.ParticleSystem:createParticleGroup|b2.ParticleSystem:createParticleGroup]] ''<translate>create group of particles</translate>''<br/><!-- GIDEROSMTD:b2.ParticleSystem:createParticleGroup -->
[[Special:MyLanguage/b2.ParticleSystem:destroyParticle|b2.ParticleSystem:destroyParticle]] ''<translate>destroy particle by id</translate>''<br/>
+
[[Special:MyLanguage/b2.ParticleSystem:destroyParticle|b2.ParticleSystem:destroyParticle]] ''<translate>destroy particle by id</translate>''<br/><!-- GIDEROSMTD:b2.ParticleSystem:destroyParticle -->
[[Special:MyLanguage/b2.ParticleSystem:destroyParticles|b2.ParticleSystem:destroyParticles]] <br/>
+
[[Special:MyLanguage/b2.ParticleSystem:destroyParticles|b2.ParticleSystem:destroyParticles]] <br/><!-- GIDEROSMTD:b2.ParticleSystem:destroyParticles -->
[[Special:MyLanguage/b2.ParticleSystem:getParticleCount|b2.ParticleSystem:getParticleCount]] <br/>
+
[[Special:MyLanguage/b2.ParticleSystem:getParticleCount|b2.ParticleSystem:getParticleCount]] <br/><!-- GIDEROSMTD:b2.ParticleSystem:getParticleCount -->
[[Special:MyLanguage/b2.ParticleSystem:getParticleGroupList|b2.ParticleSystem:getParticleGroupList]] <br/>
+
[[Special:MyLanguage/b2.ParticleSystem:getParticleGroupList|b2.ParticleSystem:getParticleGroupList]] <br/><!-- GIDEROSMTD:b2.ParticleSystem:getParticleGroupList -->
[[Special:MyLanguage/b2.ParticleSystem:setTexture|b2.ParticleSystem:setTexture]] ''<translate>set texture to particles</translate>''<br/>
+
[[Special:MyLanguage/b2.ParticleSystem:setTexture|b2.ParticleSystem:setTexture]] ''<translate>set texture to particles</translate>''<br/><!-- GIDEROSMTD:b2.ParticleSystem:setTexture -->
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Events</translate> ===
 
=== <translate>Events</translate> ===
 
=== <translate>Constants</translate> ===
 
=== <translate>Constants</translate> ===
[[Special:MyLanguage/b2.ParticleSystem.FLAG_COLOR_MIXING|b2.ParticleSystem.FLAG_COLOR_MIXING]]<br/>
+
[[Special:MyLanguage/b2.ParticleSystem.FLAG_COLOR_MIXING|b2.ParticleSystem.FLAG_COLOR_MIXING]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_COLOR_MIXING -->
[[Special:MyLanguage/b2.ParticleSystem.FLAG_ELASTIC|b2.ParticleSystem.FLAG_ELASTIC]]<br/>
+
[[Special:MyLanguage/b2.ParticleSystem.FLAG_ELASTIC|b2.ParticleSystem.FLAG_ELASTIC]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_ELASTIC -->
[[Special:MyLanguage/b2.ParticleSystem.FLAG_POWDER|b2.ParticleSystem.FLAG_POWDER]]<br/>
+
[[Special:MyLanguage/b2.ParticleSystem.FLAG_POWDER|b2.ParticleSystem.FLAG_POWDER]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_POWDER -->
[[Special:MyLanguage/b2.ParticleSystem.FLAG_SPRING|b2.ParticleSystem.FLAG_SPRING]]<br/>
+
[[Special:MyLanguage/b2.ParticleSystem.FLAG_SPRING|b2.ParticleSystem.FLAG_SPRING]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_SPRING -->
[[Special:MyLanguage/b2.ParticleSystem.FLAG_TENSILE|b2.ParticleSystem.FLAG_TENSILE]]<br/>
+
[[Special:MyLanguage/b2.ParticleSystem.FLAG_TENSILE|b2.ParticleSystem.FLAG_TENSILE]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_TENSILE -->
[[Special:MyLanguage/b2.ParticleSystem.FLAG_VISCOUS|b2.ParticleSystem.FLAG_VISCOUS]]<br/>
+
[[Special:MyLanguage/b2.ParticleSystem.FLAG_VISCOUS|b2.ParticleSystem.FLAG_VISCOUS]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_VISCOUS -->
[[Special:MyLanguage/b2.ParticleSystem.FLAG_WALL|b2.ParticleSystem.FLAG_WALL]]<br/>
+
[[Special:MyLanguage/b2.ParticleSystem.FLAG_WALL|b2.ParticleSystem.FLAG_WALL]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_WALL -->
[[Special:MyLanguage/b2.ParticleSystem.FLAG_WATER|b2.ParticleSystem.FLAG_WATER]]<br/>
+
[[Special:MyLanguage/b2.ParticleSystem.FLAG_WATER|b2.ParticleSystem.FLAG_WATER]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_WATER -->
[[Special:MyLanguage/b2.ParticleSystem.FLAG_ZOMBIE|b2.ParticleSystem.FLAG_ZOMBIE]]<br/>
+
[[Special:MyLanguage/b2.ParticleSystem.FLAG_ZOMBIE|b2.ParticleSystem.FLAG_ZOMBIE]]<br/><!-- GIDEROSCST:b2.ParticleSystem.FLAG_ZOMBIE -->
 
|}
 
|}

Revision as of 14:56, 31 August 2018

Supported platforms:
Available since: Gideros 2015.06.30

Description

Defines particle system in box2d world using Liquid fun

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)

Methods

b2.ParticleSystem:containsParticle
b2.ParticleSystem:createParticle create new particle
b2.ParticleSystem:createParticleGroup create group of particles
b2.ParticleSystem:destroyParticle destroy particle by id
b2.ParticleSystem:destroyParticles
b2.ParticleSystem:getParticleCount
b2.ParticleSystem:getParticleGroupList
b2.ParticleSystem:setTexture set texture to particles

Events

Constants

b2.ParticleSystem.FLAG_COLOR_MIXING
b2.ParticleSystem.FLAG_ELASTIC
b2.ParticleSystem.FLAG_POWDER
b2.ParticleSystem.FLAG_SPRING
b2.ParticleSystem.FLAG_TENSILE
b2.ParticleSystem.FLAG_VISCOUS
b2.ParticleSystem.FLAG_WALL
b2.ParticleSystem.FLAG_WATER
b2.ParticleSystem.FLAG_ZOMBIE