Difference between revisions of "B2.World.new"
From GiderosMobile
m (added example) |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
Line 6: | Line 6: | ||
=== Description === | === Description === | ||
Creates a new [[Special:MyLanguage/b2.World|b2.World]] object. You can create more than one [[Special:MyLanguage/b2.World|b2.World]] object to manage independent worlds. | Creates a new [[Special:MyLanguage/b2.World|b2.World]] object. You can create more than one [[Special:MyLanguage/b2.World|b2.World]] object to manage independent worlds. | ||
− | < | + | <syntaxhighlight lang="lua"> |
(any), (any) = b2.World.new(gravityx,gravityy,doSleep) | (any), (any) = b2.World.new(gravityx,gravityy,doSleep) | ||
</source> | </source> | ||
Line 20: | Line 20: | ||
=== Example === | === Example === | ||
− | < | + | <syntaxhighlight lang="lua"> |
self.world = b2.World.new(0, 9.81, true) -- gravity x, gravity y, doSleep? | self.world = b2.World.new(0, 9.81, true) -- gravity x, gravity y, doSleep? | ||
</source> | </source> | ||
{{B2.World}} | {{B2.World}} |
Revision as of 14:26, 13 July 2023
Available since: Gideros 2011.6
Class: b2.World
Description
Creates a new b2.World object. You can create more than one b2.World object to manage independent worlds. <syntaxhighlight lang="lua"> (any), (any) = b2.World.new(gravityx,gravityy,doSleep) </source>
Parameters
gravityx: (number) the x component the gravity
gravityy: (number) the y component the gravity
doSleep: (boolean, default = true) improve performance by not simulating inactive bodies
Return values
Returns (any) A new b2.World object.
Returns (any) A new b2.World object.
Example
<syntaxhighlight lang="lua"> self.world = b2.World.new(0, 9.81, true) -- gravity x, gravity y, doSleep? </source>