xxxxxxxxxx
49
function setup() {
createCanvas(500, 500)
}
var ufoY = 0
var ufodirection = 1
function draw() {
background(28, 56, 99)
fill(300)
stroke(200)
strokeWeight(3)
ellipse(440,60,75,75) //moon
//grass
fill(42, 105, 66)
stroke(0)
strokeWeight(5)
rect(-100,350,1000,400)
//ufo
push()
translate(0,ufoY)
strokeWeight(4)
stroke(0)
fill(91, 99, 93)
ellipse(250,130,175,75)
fill(161, 161, 161)
ellipse(250,124,175,60)
fill(153, 204, 197)
ellipse(250,110,75,60)
fill(300)
strokeWeight(0)
ellipse(232,100,20,20)
ellipse(243,90,10,10)
pop()
//movement
ufoY = ufoY + 0.25 * ufodirection
if(ufoY > 20 )
{
ufodirection = -1
}
if(ufoY < 10 )
{
ufodirection = 1
}
}