Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
void setup (){
  size (400,400); // Set screen size
  frameRate(60);
  noStroke();
}

void draw (){
  
  background(170,170,255); //set backgound colour to a light blue
  
  fill(27,255,27);
  rect(0,360,400,40); //Draw field
  
  fill(100);
  rect(mouseX/2-30,340,30,20); //Code keep
  
  fill(120);
  rect(mouseX/2-40,330,10,30);
  rect(mouseX/2-45,320,20,10);
  rect(mouseX/2,330,10,30);
  rect(mouseX/2-5,320,20,10); //Code keep towers
  
  fill(0);
  rect(mouseX/2-20,350,10,10); //Code keep gate
  
  fill(255,100);
  rect(mouseX+100,270,70,10);
  rect(mouseX+130,260,30,10);
  rect(mouseX+150,250,10,10); //Add cloud 1
  
  rect(mouseX/5+310,120,90,10);
  rect(mouseX/5+320,110,70,10);
  rect(mouseX/5+360,100,30,10);
  rect(mouseX/5+370,90,20,10); //Add cloud 2
  
  rect(mouseX+70,100,10,10);
  rect(mouseX+40,110,50,10);
  rect(mouseX+20,120,80,10); //Add cloud 3
  
  fill(255,63,63,255);
  triangle (180,20+sin((mouseX+20)*100.5)*360,180,170,140,170); //Code and draw right wing
  
  fill(255,63,63,255);
  quad(70,150,60,160,100,160,110,150);
  rect(90,160,10,10); //Draw upper jaw
  
  triangle(100,160,110,160,110,170);
  triangle(110,160,120,160,120,170);
  triangle(120,160,130,160,130,170);
  triangle(130,160,140,160,140,170); //Draw back of neck
 
  fill(255,0,0);
  quad(100,160,100,170,110,180,110,170);
  quad(110,160,110,170,120,180,120,170);
  quad(120,160,120,170,130,180,130,170);
  quad(130,160,130,170,140,180,140,170); //Draw neck underside
  
  quad(60,170,70,180,90,180,100,170); //Draw lower jaw
  
  quad(140,180,160,200,200,200,220,180); //Draw chest
  
  fill(255,63,63,255);
  rect(140,160,100,20); //Draw main body
  
  fill(255);
  rect(60,160,30,10); //Draw teeth
  
  quad(90,150,110,150,120,140,100,140); //Draw horns
  
  fill(255);
  triangle(120,150,110,160,120,160);
  triangle(130,150,120,160,130,160);
  triangle(140,150,130,160,140,160);
  triangle(150,150,140,160,150,160); 
  triangle(170,150,160,160,170,160);
  triangle(190,150,180,160,190,160);
  triangle(210,150,200,160,210,160);
  triangle(230,150,220,160,230,160); //Draw back spikes
  
  fill(255,63,63);
  triangle(240,160,260,160,260,180);
  triangle(260,160,280,160,280,180);
  triangle(280,160,300,160,300,180);
  
  fill(255,0,0);
  triangle(240,160,240,180,260,180);
  triangle(260,160,260,180,280,180);
  triangle(280,160,280,180,300,180);
  quad(300,160,300,180,320,200,320,180);
  quad(320,180,320,200,340,180,340,160);
  triangle(340,180,340,160,360,180);
  rect(220,200,20,20);
  quad(240,200,260,220,260,230,240,230);
  triangle(220,180,220,220,200,200);
  fill(255);
  triangle(260,230,260,240,250,230);
  //Draw tail
  
  
  fill(255,0,0,255);
  triangle (190,20+sin((mouseX+20)*100.5)*360,190,170,150,170); //Code and draw left wing
  
  fill(255,100);
  rect(mouseX*2-60,50,10,10);
  rect(mouseX*2-30,60,50,10);
  rect(mouseX*2-10,70,80,10); //Add cloud 4
  
  rect(mouseX*1.25-80,200,10,10);
  rect(mouseX*1.25-100,210,50,10);
  rect(mouseX*1.25-120,220,80,10); //Add cloud 5
  
  rect(mouseX*2-310,120,90,10);
  rect(mouseX*2-320,110,70,10);
  rect(mouseX*2-360,100,30,10);
  rect(mouseX*2-370,90,20,10);
  
  rect(mouseX*1.05-210,320,90,10);
  rect(mouseX*1.05-220,310,70,10);
  rect(mouseX*1.05-260,300,30,10);
  rect(mouseX*1.05-2,90,20,10);
  
  rect(mouseX/4-80,200,10,10);
  rect(mouseX/4-100,210,50,10);
  rect(mouseX/4-120,220,80,10);
}