Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
//Kirby Flapping His Little Arms
//Program By: Wesley Cox
//This program is designed to be an interactive drawing
//where you can move the mouse to make Kirby flap his arms and feet
//in order to simulate the flying animations he has in game.
//If the mouse is pressed, Kirby will look completely apalled as
//if he has just been injured in game.


void setup() 
{
  //set window size to 400x400 pixels
  size(400,400);

//removing the cursor
noCursor();
}

void draw() 
{
  //Setting the background to a night sky colour
  background(0,0,48);
  //Removing strokes to get rid of those pesky black lines
  noStroke();
  //Setting the framerate to 60 FPS
  frameRate(60);
  //Making the Background Stars
  //Concept and Code used from Conor Norman's "Elite Dangerous Logo" program
  rectMode(CENTER);

  fill(255, 255, 138, 80*sin(frameCount*0.30));
  rect(300, 10, 4, 4);
  rect(100, 80, 5, 5);
  rect(90, 350, 3, 3);
  rect(220, 170, 4, 4);
 
  fill(255, 255, 255, 80*sin(frameCount*0.20));
  rect(312, 315, 5, 5);
  rect(60, 185, 5, 5);
  rect(350, 85, 6, 6);
  rect(190, 250, 3, 3);
 
  fill(255, 255, 138, 80*sin(frameCount*0.15));
  rect(330, 200, 6, 6);
  rect(210, 340, 5, 5);
  rect(230, 70, 2, 2);
 
  fill(255, 255, 255, 80*sin(frameCount*0.1));
  rect(40, 280, 5, 5);
  rect(130, 20, 5, 5);
  rect(20, 20, 3, 3);

  //Making Kirby
  //Feet
  fill(255,31,90);
  arc(160+mouseX/17,260+mouseY/20,50,62,0,PI*2-PI/2);
  arc(215-mouseX/17,262+mouseY/20,50,62,0,PI/2+PI*2);

  //Arms
  fill(215,114,232);
  arc(135+mouseX/13,170+mouseY/8,55,66,0,PI/2+PI*2);
  arc(265-mouseX/13,170+mouseY/8,55,66,0,PI*2+PI/2);

  //Main Body
  ellipseMode(CENTER);
  fill(236,125,255);
  ellipse(200,200+mouseY/20,150,150);

  //Eyes
  fill(0);
  ellipse(215,185+mouseY/10,15,40);
  ellipse(245,185+mouseY/10,15,40);
  fill(255);
  ellipse(210,172+mouseY/10,10,13);
  ellipse(240,172+mouseY/10,10,13);

  //Blush
  fill(224,67,67);
  ellipse(205,210+mouseY/10,18,10);
  ellipse(255,210+mouseY/10,18,10);

  //Mouth
  fill(189,23,76);
  ellipse(232,223+mouseY/10,12,8);
  fill(240,102,216);
  ellipse(225,225+mouseY/10,10,20);
  fill(236,125,255);
  ellipse(220,225+mouseY/10,10,22);  
  
}
 //Makes Kirby get hurt when you press the mouse
  void mousePressed() {
   frameRate(2);
   fill(255);
   ellipse(215,185+mouseY/10,35,40);
   ellipse(245,185+mouseY/10,35,40);
   fill(0);
   ellipse(205+mouseX/15,185+mouseY/8,10,10);
   ellipse(230+mouseX/15,185+mouseY/8,10,10);
}