Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/******************************************************************
*File Name: Ryu Program
*Author: Jacob Estrella
*Date: September 22,2016
*Description: An interactive drawing featuring Ryu from Street 
*Fighter. Shaking the mouse controls the opacity/size of the 
*Hadouken Sprite and its particles. When the player presses a key,
*the sprite is then thrown, and the phrase "HADOUKEN!" displays.
******************************************************************/

void setup()
{
  size(400,400);
}

//Hadouken Charge Animation
void draw()
{ 
  frameRate(60);
  background(0);
  noStroke();
  
  //Shadow
  fill(150);
  ellipse(180,340,180,40);
  
  //Right Bicep
  fill(222,185,135);
  rect(220,100,40,60);
  
  //Body
  fill(255);
  quad(140,100,240,100,220,220,160,220);
  
  //Right Forearm
  fill(222,185,135);
  quad(260,150,260,180,180,180,180,160);
  
  //Legs
  fill(255);
    //Left Thigh
    triangle(180,180,180,260,140,260);
    //Right Thigh
    triangle(200,180,200,260,240,260);
    //Left Calf
    triangle(140,260,180,260,140,340);
    //Right Calf
    triangle(200,260,240,260,240,340);
  
  //Feet
  fill(222,185,135);
    //Left Foot
    quad(140,320,140,340,170,340,170,330);
    //Right Foot
    quad(240,320,240,340,270,340,270,330);
  
  //Left Arm
  fill(222,185,135);
    //Bicep
    quad(160,100,80,100,80,120,160,140);
    //Forearm
    rect(80,100,20,40);
  
  //Right Hand Thumbs
  rect(190,144,8,16,50);
  
  //Left Hand Thumbs
  rect(100,140,16,8,50);
  
  //Gloves
  fill(128,0,0);
    //Right Glove
    ellipse(190,170,30,30);
    //Left Glove
    ellipse(90,140,30,30); 
  
  //Right Hand Fingers
  fill(222,185,135);
    //Index
    rect(170,155,16,8,50);
    //Middle
    rect(170,162,16,8,50);
    //Ring
    rect(170,170,16,8,50);
    //Pinky
    rect(170,178,16,8,50);
  
  //Left Hand Fingers
    //Index
    rect(97,145,8,16,50);
    //Middle
    rect(90,145,8,16,50);
    //Ring
    rect(83,145,8,16,50);
    //Pinky
    rect(76,145,8,16,50);
    
  //Exposed Chest
  fill(222,185,135);
  triangle(200,100,230,100,220,160);
  
  //Head
  fill(222,185,135);
  ellipse(210,90,60,60);
  
  //Hair
  fill(128,0,0);
    //Top Piece
    rect(180,60,60,20,50);
    //Side Piece
    rect(180,60,20,40,50);
  
  //Belt
  //Outline
  stroke(255);
  fill(0);
    //Left Belt Flap
    triangle(180,200,200,200,180,240);
    //Right Belt Flap
    triangle(180,200,200,200,200,240);
    //Centre Belt
    rect(150,200,80,20);
  
  //Head Band
  noStroke();
  fill(255,0,0);
    //Main Head Band
    rect(180,80,60,10);
    //Hand Band Tail
    triangle(190,80,175,80,175,100);
  
  //Hadouken Sprite
  //mouseX and mouseY allows for variation in the main sprite opacity/size
  fill(0,0,205,mouseY);
  ellipse(120,190,60+(mouseY/100),60+(mouseY/100));
  fill(65,105,225,mouseY);
  ellipse(120,190,55+(mouseY/100),55+(mouseY/100));
  fill(0,191,255,mouseX);
  ellipse(120,190,50+(mouseX/100),50+(mouseX/100));
  fill(0,255,255,mouseX);
  ellipse(120,190,45+(mouseX/100),45+(mouseX/100));
  
  //Hadouken Sprite Particles
  //mouseX and mouseY allows for variation in the sprite particle opacity/size
  //White Particles
  fill(255,255,255,mouseX);
  ellipse(90,190,random(8,15),random(8,15));
  fill(255,255,255,(mouseX+2));
  ellipse(120,220,random(8,15),random(8,15));
  fill(255,255,255,(mouseX/2));
  ellipse(140,170,random(8,15),random(8,15));
  fill(255,255,255,(mouseX*2));
  ellipse(140,200,random(8,15),random(8,15));
  
  //Blue Particles
  fill(0,191,255,mouseY);
  ellipse(110,170,random(8,15),random(8,15));
  fill(0,191,255,(mouseY*2));
  ellipse(110,200,random(8,15),random(8,15));
  fill(0,191,255,(mouseY+2));
  ellipse(135,175,random(8,15),random(8,15)); 
}

//Throw Animation
void keyPressed()
{
  frameRate(1);
  background(0);
  noStroke();
  
  //Shadow
  fill(150);
  ellipse(180,340,180,40);
  
  //Right Arm
  fill(222,185,135);
  rect(220,100,120,30);
  
  //Body
  fill(255);
  quad(140,100,240,100,220,220,160,220);
  
  //Legs
    //Left Thigh
    triangle(180,180,180,260,140,260);
    //Right Thigh
    triangle(200,180,200,260,240,260);
    //Left Calf
    triangle(140,260,180,260,140,340);
    //Right Calf
    triangle(200,260,240,260,200,340);
    
  //Feet
  fill(222,185,135);
  //Left Foot
  quad(140,320,140,340,170,340,170,330);
  //Right Foot
  quad(200,320,200,340,230,340,230,330);
  
  //Left Arm
    //Bicep
    quad(140,100,120,160,140,160,180,100);
    //Forearm
    quad(125,150,110,180,200,180,200,160);
  
  //Exposed Chest
  fill(222,185,135);
  triangle(200,100,230,100,220,160);
  
  //Gloves
  fill(128,0,0);
    //Left Glove
    ellipse(190,170,30,30);
    //Right Glove
    ellipse(340,115,30,30);
  
  //Left Hand Fingers
  fill(222,185,135);
    //Index
    rect(195,155,12,8,50);
    //Middle
    rect(195,162,12,8,50);
    //Ring
    rect(195,169,12,8,50);
    //Pinky
    rect(195,176,12,8,50);

  //Right Hand Fingers
    //Thumb
    rect(335,115,12,8,50);
    //Index
    rect(350,105,8,20,50);
  
  //Head
  fill(222,185,135);
  ellipse(210,90,60,60);
  
  //Hair
  fill(128,0,0);
    //Top Piece
    rect(180,60,60,20,50);
    //Side Piece
    rect(180,60,20,40,50);
  
  //Belt
  stroke(255);
  fill(0);
    //Left Belt Flap
    triangle(180,200,200,200,180,240);
    //Right Belt Flap
    triangle(180,200,200,200,200,240);
    //Centre Belt
    rect(150,200,80,20);
  
  //Head Band
  noStroke();
  fill(255,0,0);
    //Main Head Band
    rect(180,80,60,10);
    //Head Band Tail
    triangle(190,80,175,80,175,100);
  
  //Hadouken
  println("HADOUKEN!");
}