Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
void setup() {
  size(400, 400);//set the size of the program 
  strokeWeight(2);//makes the outlines on things (namely the screens) just a bit thicker
  smooth(8);//Ill be honest Im not sure what this does, its supposed to increase the anti ailiaing but either im working on such a small scale that I cant see the difference or Im doing something wrong
}

void draw() {
  //colours the background a pleasant pastel teal
  background(199,211,232);
  
  //shadow
  fill(175,186,204);//makes the shadow a bit darker than the background
  ellipse(198,265, 300,90);
  
  //DS body
  noStroke();//removes the outline
  fill(49,178,255);//colours the DS a middle blue
  quad(50,240, 140,290, 350,240, 260,200); //bottom plate
  quad(50,240, 260,200, 230,95, 20,110); //top plate
  
  
  //screens
  fill(70);//makes the screens a dark grey
  stroke(49,141,255);//gives the screens a dark outline
  quad(80,130, 200,120, 220,188, 100,210); //top screen
  quad(135,238, 217,222, 275,250, 190,270);//bottom screen
  
  //stars 80-220x 120-210y 
  stroke(255);//white
  point(90,140);
  point(100,190);
  point(115,200);
  point(150,190);
  point(150,130);
  point(190,130);
  point(120,150);
  point(130,175);
  point(100,160);
  point(160,160);
  point(200,175);

  //spaceship
  noStroke();//removes outline
  fill(230);//makes the spaceship a very light grey
  quad(mouseX/2.3+6,mouseX/-10.5 +180+9.5, mouseX/2.3+10,mouseX/-10.5 +180+24.5, mouseX/2.3+30,mouseX/-10.5 +180+21, mouseX/2.3+26,mouseX/-10.5 +180+6);//positions the body of the ship so that it stays within the screen and moves along an angle. Thanks Paul!
  triangle(mouseX/2.3+29.5,mouseX/-10.5 +180+21, mouseX/2.3+25.5,mouseX/-10.5 +180+6, mouseX/2.3+35,mouseX/-10.5 +180+12);//positions the nose of the ship so that it stays within the screen and moves along an angle
  //spaceship wings
  fill(255,100,100);//pale red
  triangle(mouseX/2.3+10,mouseX/-10.5 +180+24.5, mouseX/2.3+12,mouseX/-10.5 +180+30, mouseX/2.3+20,mouseX/-10.5 +180+23);//positions the bottom wing of the ship so that it stays within the screen and moves along an angle
  triangle(mouseX/2.3+6,mouseX/-10.5 +180+9.5, mouseX/2.3+5,mouseX/-10.5 +180+4, mouseX/2.3+15,mouseX/-10.5 +180+8);//positions the top wing of the ship so that it stays within the screen and moves along an angle
 
  //exhaust
  fill(255,87,31);//red
  triangle(mouseX/2.3+6,mouseX/-10.5 +180+9.5, mouseX/2.3+10,mouseX/-10.5 +180+24.5, mouseX/2.3-6,mouseX/-10.5 +180+random(9.5,24.5));//positions the exhaust of the ship so that it stays within the screen and moves along an angle, as well as makes is move w/ random
  fill(255,184,31);//orange
  triangle(mouseX/2.3+6,mouseX/-10.5 +180+9.5, mouseX/2.3+10,mouseX/-10.5 +180+24.5, mouseX/2.3-6,mouseX/-10.5 +180+random(9.5,24.5));//positions the exhaust of the ship so that it stays within the screen and moves along an angle, as well as makes is move w/ random
  fill(254,255,31);//yellow
  triangle(mouseX/2.3+6,mouseX/-10.5 +180+9.5, mouseX/2.3+10,mouseX/-10.5 +180+24.5, mouseX/2.3-3,mouseX/-10.5 +180+random(12,28));//positions the exhaust of the ship so that it stays within the screen and moves along an angle, as well as makes is move w/ random
  
  //to hide character as it goes off to the left
  fill(49,178,255);//middle blue
  quad(80,130, 100,210, 45,220, 20,110);//left side top cover
  fill(199,211,232);//light blue
  triangle(0,65, 43,241, 0,241);//background cover
  
 //DS body cont. 
  fill(70,200,255);
  quad(50,240, 140,290, 140,310, 50,260);//bottom left pannel
  quad(140,290, 350,240, 350,260, 140,310);//bottom right pannel
  quad(50,240, 20,110, 13,120, 42,241);//top left pannel

  //hinge
  noStroke();
  fill(49,178,255);//meduim blue
  quad(50, 226, 255, 185, 270, 204, 60, 245);//hinge
  arc(259, 200, 20, 30, 4.4, TWO_PI+.26);//right side of the hinge
  fill(70,200,255);//light blue
  arc(50, 242, 20, 30, 4.4, TWO_PI+.26);//left side of the hinge

  //buttons - left side
  //button bottoms
  fill(49,141,255);//dark blue
  ellipse(260, 218, 10, 5);//top left
  ellipse(255, 227, 10, 5);//bottom left
  ellipse(278, 220, 10, 5);//top right
  ellipse(273, 229, 10, 5);//bottom left
  
  //button tops
  fill(70,200,255);//light blue
  ellipse(273, 226, 10, 5);
  ellipse(260, 215, 10, 5);
  ellipse(278, 217, 10, 5);
  ellipse(255, 224, 10, 5);
  
  //buttons - right side
  //circle pad
  fill(49,141,255);//dark blue
  ellipse(115, 252, 36, 20);//shadow
  fill(49,178,255);//medium blue
  ellipse(115, 253, 30, 15);//depth
  fill(70,200,255);//light blue
  ellipse(115, 250, 30, 15);//top
  
  //dpad sides+
  fill(49,141,255);//dark blue
  quad(164,265, 164,270, 150,275, 150,270);//this part is also part of the dpad sides but its not perfectly fit and if rendered togther with the rest of the sides itll look wrong.
  
  //dpad top
  fill(70,200,255);//light blue
  quad(130,263, 140,260, 160,272, 150,275);
  quad(127,270,135,275,164,265,155,260);
  
  //dpad sides
  fill(49,141,255);//dark blue
  triangle(130,263,130,268,135,267);
  quad(160,272,150,275,150,280,160,277);
  quad(150,275,150,280,145,277,145,272);
  quad(145,272,145,277,135,280,135,275);
  quad(135,280,135,275,127,270,127,275);
  
}