First display an object :
|
1 2 3 4 5 |
local triangle = display.newImage("triangle.png") triangle.x = 200 triangle.y = 150 |
Then, define the shape of the body :
|
1 2 3 |
triangleShape = { 0,-35, 37,30, -37,30 } --Note : These polygon coordinates must be defined in clockwise order. |
Add physics to the body and specify the shape :
|
1 |
physics.addBody( triangle, { density=1.6, friction=0.5, bounce=0.2, shape=triangleShape } ) |
Incoming search terms:
- corona sdk polygon shapes
- make a triangle corona
Filed under: Corona
Like this post? Subscribe to my RSS feed and get loads more!




Leave a Reply