function setup()
supportedOrientations(LANDSCAPE_ANY)
local h = HEIGHT/15
local w = WIDTH/10
shipPoints = {
vec2(0,0),
vec2(0,h),
vec2(w,h),
vec2(w*1.3,h/2),
vec2(w,0)}
ship = physics.body(POLYGON, unpack(shipPoints))
ship.x = WIDTH/2
ship.y = HEIGHT/2
end
function draw()
background(0, 0, 0, 255)
strokeWidth(5)
stroke(73, 255, 0, 255)
local points = ship.points
for j = 1,#points do
a = points[j]
b = points[(j % #points)+1]
line(a.x, a.y, b.x, b.y)
end
end
Ok so I guess I’m asking this; how do ship. x and y and vec2 coordinates impact the location of my physics body? Also how would I make the bodies location changeable and use it’s location as a variable. Also if there are errors or dumb things in my code please lmk. Thanks everyone.