reference / collision
outline
The corners of the solid part of a picture, as a list of vectors that makes a shape of its own: touching ball { points: outline ship }. A pixel is solid when it is more than 50 percent solid, or more than the alpha given; at puts the picture's top left where it is drawn and size stretches it as image does. Only the biggest solid piece is outlined, without its holes.
ship = load "ship.png"image ship at 140 90corners = outline ship at { 140, 90 }for each p in corners [ circle at p radius 3 fill navy ]ball = { pos: { 150, 100 }, radius: 14 }hull = { points: outline ship at { 140, 90 } }if touching ball hull [ fill tomato ] else [ fill teal ]circle at ball.pos radius 14
How to write it
outline picture [at number number] [size number number] [alpha number]
Gives a list.