Just playing around with physics for the first time.
I don’t want to use a png image to represent a space ship, but rather, draw it using lines
So can someone explain why this spaceship doesn’t fall off the platform?
local physics = require "physics" physics.start() physics.setGravity( 0, 10 ) physics.setDrawMode("hybrid") local myRectangle = display.newRect(0, 600, 320, 100) myRectangle:setFillColor(140, 140, 140) myRectangle:setStrokeColor(180, 180, 180) physics.addBody( myRectangle, "static", { density=1.6, friction=0.5, bounce=0.1, shape=rectangleShape } ) local ship = display.newLine( 200,0, 300,200 ) ship:append( 200,160, 100,200, 200,0 ) ship.x = 310 ship.y = 0 shipRightShape = { 100,200, 0,160, 0,0} shipLeftShape = {-100,200, 0,160, 0,0} physics.addBody( ship, "dynamic", { density=1.6, friction=0.5, bounce=0.2, shape=shipRightShape }, { density=1.6, friction=0.5, bounce=0.2, shape=shipLeftShape } )