Difference between revisions of "B2.CircleShape"
From GiderosMobile
Line 2: | Line 2: | ||
'''Supported platforms:''' android, ios, mac, pc<br/> | '''Supported platforms:''' android, ios, mac, pc<br/> | ||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
− | === Description === | + | === <translate>Description</translate> === |
<translate><br /> | <translate><br /> | ||
A circle shape.<br /> | A circle shape.<br /> | ||
<br /></translate> | <br /></translate> | ||
− | === Examples === | + | === <translate>Examples</translate> === |
'''Creating a circle body'''<br/> | '''Creating a circle body'''<br/> | ||
<source lang="lua">--create ball bitmap object from ball graphic | <source lang="lua">--create ball bitmap object from ball graphic | ||
Line 27: | Line 27: | ||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === Methods === | + | === <translate>Methods</translate> === |
[[Special:MyLanguage/b2.CircleShape.new|b2.CircleShape.new]] <br/> | [[Special:MyLanguage/b2.CircleShape.new|b2.CircleShape.new]] <br/> | ||
[[Special:MyLanguage/b2.CircleShape:set|b2.CircleShape:set]] ''<translate>sets the center point and radius</translate>''<br/> | [[Special:MyLanguage/b2.CircleShape:set|b2.CircleShape:set]] ''<translate>sets the center point and radius</translate>''<br/> | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === Events === | + | === <translate>Events</translate> === |
− | === Constants === | + | === <translate>Constants</translate> === |
|} | |} |
Revision as of 07:29, 24 August 2018
Supported platforms: android, ios, mac, pc
Available since: Gideros 2011.6
Description
A circle shape.
Examples
Creating a circle body
--create ball bitmap object from ball graphic
local ball = Bitmap.new(Texture.new("./ball.png"))
--reference center of the ball for positioning
ball:setAnchorPoint(0.5,0.5)
ball:setPosition(x,y)
--get radius
local radius = ball:getWidth()/2
--create box2d physical object
local body = world:createBody{type = b2.DYNAMIC_BODY}
body:setPosition(ball:getX(), ball:getY())
body:setAngle(ball:getRotation() * math.pi/180)
local circle = b2.CircleShape.new(0, 0, radius)
local fixture = body:createFixture{shape = circle, density = 1.0,
friction = 0.1, restitution = 0.2}
Methodsb2.CircleShape.new |
EventsConstants |