@Scotty - in short I used your code, listing attached - change the names to avoid clash with other project. The compass I drew myself, needs a little adjustment.
— Landing
function setup()
--
X,Y = WIDTH/2, HEIGHT/2
commonColors()
createImageDrone()
landingZone()
drawDroneLights()
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
sprite(land,WIDTH//2,HEIGHT//2)
sprite(drone,WIDTH//2,HEIGHT//4)
end
function landingZone()
local size = 50
land = image(size,size)
setContext(land)
pushMatrix()
translate(size//2,size//2)
pushStyle()
rectMode(CENTER)
strokeWidth(0)
fill(orange)
rect(0,0, size)
fill(white)
rect(0,0, size*.8)
fill(black)
fontSize(size*.6)
font("Arial-BoldMT")
text("H", 0,0)
text("_", 0,0)
popStyle()
popMatrix()
setContext()
saveImage(asset.documents.."landing",land)
end
function createImageDrone()
-- Creates an image that represents the drone w/o lights
myImageDrone = image(X,Y)
setContext(myImageDrone)
drawDroneBody()
setContext()
saveImage(asset.documents.."drone2",drone)
end
function drawDroneBody(x,y)
-- Image of drone w/o lights.
local x,y = x,y
local mSize = 50
local size = 110
local droneColor = gray
drone = image(size,size)
setContext(drone)
pushMatrix()
translate(size//2,size//2)
pushStyle()
-- arms
lineCapMode(ROUND)
stroke(droneColor)
fill(droneColor)
for i=1,4 do
-- background(255)
rotate(90)
strokeWidth(mSize*.2)
stroke(black)
line(0,0, mSize*.625,mSize*.625)
strokeWidth(mSize*.15)
stroke(droneColor)
line(0,0, mSize*.625,mSize*.625)
strokeWidth(mSize*.01)
fill(170, 170, 170, 74)
ellipse(mSize*.625,mSize*.625, 50)
fill(black)
ellipse(mSize*.625,mSize*.625, 6)
end
-- body outline
stroke(black)
strokeWidth(mSize*.275)
line(-mSize*.13, -mSize/2, -mSize*.09, mSize/2) -- l
line( mSize*.13, -mSize/2, mSize*.09, mSize/2) -- r
line(-mSize*.13, -mSize/2, mSize*.09,-mSize/2) -- b
line(-mSize*.09, mSize/2, mSize*.09, mSize/2) -- t
-- body
stroke(droneColor)
strokeWidth(mSize*.2)
line(-mSize*.13, -mSize/2, -mSize*.09, mSize/2) -- l
line( mSize*.13, -mSize/2, mSize*.09, mSize/2) -- r
line(-mSize*.13, -mSize/2, mSize*.09,-mSize/2) -- b
line(-mSize*.09, mSize/2, mSize*.09, mSize/2) -- t
strokeWidth(mSize*.1)
line(0,-mSize/2, 0,mSize/2) -- fill in what got missed
popStyle()
-- forward arrow
pushStyle()
stroke(black)
strokeWidth(3)
lineCapMode(ROUND)
line(0,30, 0,-20)
line(0,30, 5,0)
line(0,30, -5,0)
popStyle()
popMatrix()
setContext()
end
function drawDroneLights()
-- Drone's flashing lights.
local x,y = x,y
local mSize = 60
local droneColor = gray
setContext(drone)
pushMatrix()
translate(55,100)
pushStyle()
-- tail light outline
strokeWidth(2)
stroke(black)
-- line(-6,-mSize/2-48, 6,-mSize/2-48)
-- head light outline
fill(white)
ellipse(0,mSize/2-44, 12)
-- myTimer(2)
-- tail light
strokeWidth(5)
-- line(-8,-mSize/2-8, 8,-mSize/2-8)
stroke(black)
-- head light
-- ellipse(-4,mSize/2-108, 4,16)
line(-8,-76,8,-76)
stroke(green)
strokeWidth(4)
line(-7,-76,7,-76)
popStyle()
popMatrix()
setContext()
saveImage(asset.documents.."droneLit",drone)
end
function commonColors()
red = color(209,0,0,255)
orange = color(255,102,34,255)
yellow = color(255,218,33,255)
green = color(51, 221, 0, 255)
blue = color(16, 51, 204, 255)
white = color(255, 255, 255, 255)
gray = color(127, 127, 127, 255)
black = color(0, 0, 0, 255)
brown = color(165, 40, 41, 255)
end