SHOW:
|
|
- or go back to the newest paste.
| 1 | local rect = display.newImageRect( "rect.png", yolo, yolo) | |
| 2 | rect.myName = "rect" | |
| 3 | rect:setReferencePoint( display.CenterReferencePoint ) | |
| 4 | - | rect.x = 150 + (rect.width/2) |
| 4 | + | local xExtent, yExtent = rect.width/2, rect.height/2 |
| 5 | - | rect.y = sidesH + (rect.height/2) |
| 5 | + | rect.x = 150 + xExtent |
| 6 | - | local rectShape = { rect.width/2,rect.height/2, rect.width/2, -rect.height/2, 0,0, -rect.width/2, -rect.height/2, -rect.width/2, rect.height/2 }
|
| 6 | + | rect.y = sidesH + yExtent |
| 7 | local rectShape = { xExtent, yExtent; xExtent, -yExtent; 0, 0; -xExtent, -yExtent; -xExtent, yExtent }
| |
| 8 | physics.addBody(rect, "dynamic", { density=1.0, bounce=0, friction=0, shape = rectShape})
| |
| 9 | rect:setLinearVelocity (10000, 0) --100 is normal | |
| 10 | rect:rotate(90) | |
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | --------- | |
| 15 | ||
| 16 | ||
| 17 | local bottom = display.newImageRect( "bottom.png", levelend, sidesH) | |
| 18 | bottom:setReferencePoint( display.BottomLeftReferencePoint ) | |
| 19 | bottom.x = 0 | |
| 20 | bottom.y = screenH - sidesH | |
| 21 | physics.addBody( bottom, "static", { density=1.0, bounce=0, friction=0.5, isSensor = false}) |