/*
******For Egypt!!*****
By Kai Zhuang
2018.9.16
Egypt is going to have a war with Rome. Before
the battle, the general is encouraging the morale.
When the player moves mouse vertically, the general's arm
moves vertically.
*/
void setup()
{
//set the size of the paper
size (400,400);
}
void draw(){
noStroke();
//set framerate to 60(different to when mouse click)
frameRate(60);
rectMode(CORNERS);
//set background that can be changed by moving mouse vertically(sunny day to sandstorm)
background(255-mouseY/5,244,142+mouseY/5);
//Pyramid
fill(247,198,122);
triangle(220,140,100,320,340,320);
triangle(80,200,0,320,160,320);
fill(213,144,41);
triangle(80,200,0,320,50,320);
triangle(220,140,100,320,180,320);
//Ground(5levels of color)
fill(158,113,58);
rect(0,370,400,400);
fill(163,118,62);
rect(0,350,400,370);
fill(168,123,66);
rect(0,340,400,350);
fill(173,128,70);
rect(0,330,400,340);
fill(178,133,74);
rect(0,320,400,330);
//Sun(the edges will always winking)
ellipseMode(CENTER);
fill(254,224,80,170);
ellipse(340,60, 40+10*sin(frameCount*.1), 40+10*sin(frameCount*.1));
fill(254,234,80,130);
ellipse(340,60, 50+10*sin(frameCount*.1), 50+10*sin(frameCount*.1));
fill(254,255,85,90);
ellipse(340,60, 60+10*sin(frameCount*.1), 60+10*sin(frameCount*.1));
fill(254,255,95,50);
ellipse(340,60, 70+10*sin(frameCount*.1), 70+10*sin(frameCount*.1));
fill(254,255,105,50);
ellipse(340,60, 90+10*sin(frameCount*.1), 90+10*sin(frameCount*.1));
fill(254,199,80,190);
ellipseMode(CORNERS);
ellipse(325,45,355,75);
//Cloud(moves horizontally when mouse moves horizontally)
fill(255,255,255,180);
rect(-40+mouseX/1,110,-130+mouseX/1,130,7);
rect(-70+mouseX/1,100,-120+mouseX/1,110,7,7,0,0);
rect(-80+mouseX/1,90,-110+mouseX/1,100,7,7,0,0);
rect(160+mouseX/2,60,240+mouseX/2,80,7);
rect(170+mouseX/2,50,220+mouseX/2,60,7,7,0,0);
rect(190+mouseX/2,40,220+mouseX/2,50,7,7,0,0);
//Solider1//
//head
noStroke();
rectMode(CORNERS);
fill(0);
rect(40,240,60,260);
//neck
fill(212,174,158);
rect(45,260,55,265);
//face
fill(252,205,183);
quad(42,245,58,245,55,260,45,260);
//body
quad(35,265,65,265,60,295,40,295);
//arm(moves vertically when mouse moves vertically)
rect(35,235+mouseY/15,38,265+mouseY/15);
rect(62,240+mouseY/15,65,270+mouseY/15);
//pant
fill(255);
quad(40,295,60,295,65,315,35,315);
//leg
rect(43,315,48,335);
rect(55,315,60,335);
//foot
rect(42,335,49,340);
rect(54,335,61,340);
//shield(moves vertically when mouse moves vertically)
stroke(172,127,89);
strokeWeight(3);
fill(198,154,107);
quad(32,235+mouseY/15,27,280+mouseY/15,43,280+mouseY/15,38,235+mouseY/15);
//weapon(moves vertically when mouse moves vertically)
stroke(0);
strokeWeight(3);
line(65,215+mouseY/15,65,310+mouseY/15);
quad(65,215+mouseY/15,63,220+mouseY/15,65,215+mouseY/15,67,220+mouseY/15);
//eyes&mouth
strokeWeight(2);
line(45,250,46,250);
line(53,250,54,250);
line(48,255,52,255);
//Solider2//
//head
noStroke();
rectMode(CORNERS);
fill(0);
rect(100,240,120,260);
//neck
fill(212,174,158);
rect(105,260,115,265);
//face
fill(252,205,183);
quad(102,245,118,245,115,260,105,260);
//body
quad(95,265,125,265,120,295,100,295);
//arm
rect(95,235+mouseY/15,98,265+mouseY/15);
rect(122,240+mouseY/15,125,270+mouseY/15);
//pant
fill(255);
quad(100,295,120,295,125,315,95,315);
//leg
rect(103,315,108,335);
rect(115,315,120,335);
//foot
rect(102,335,109,340);
rect(114,335,121,340);
//shield
stroke(172,127,89);
strokeWeight(3);
fill(198,154,107);
quad(92,235+mouseY/15,87,280+mouseY/15,103,280+mouseY/15,98,235+mouseY/15);
//weapon
stroke(0);
strokeWeight(3);
line(125,215+mouseY/15,125,310+mouseY/15);
quad(125,215+mouseY/15,123,220+mouseY/15,125,215+mouseY/15,127,220+mouseY/15);
//eyes&mouth
strokeWeight(2);
line(105,250,106,250);
line(113,250,114,250);
line(108,255,112,255);
//Solider3//
//head
noStroke();
rectMode(CORNERS);
fill(0);
rect(160,240,180,260);
//neck
fill(212,174,158);
rect(165,260,175,265);
//face
fill(252,205,183);
quad(162,245,178,245,175,260,165,260);
//body
quad(155,265,185,265,180,295,160,295);
//arm
rect(155,235+mouseY/15,158,265+mouseY/15);
rect(182,240+mouseY/15,185,270+mouseY/15);
//pant
fill(255);
quad(160,295,180,295,185,315,155,315);
//leg
rect(163,315,168,335);
rect(175,315,180,335);
//foot
rect(162,335,169,340);
rect(174,335,181,340);
//shield
stroke(172,127,89);
strokeWeight(3);
fill(198,154,107);
quad(152,235+mouseY/15,147,280+mouseY/15,163,280+mouseY/15,158,235+mouseY/15);
//weapon
stroke(0);
strokeWeight(3);
line(185,215+mouseY/15,185,310+mouseY/15);
quad(185,215+mouseY/15,183,220+mouseY/15,185,215+mouseY/15,187,220+mouseY/15);
//eyes&mouth
strokeWeight(2);
line(165,250,166,250);
line(173,250,174,250);
line(168,255,172,255);
//Solider4//
//head
noStroke();
rectMode(CORNERS);
fill(0);
rect(220,240,240,260);
//neck
fill(212,174,158);
rect(225,260,235,265);
//face
fill(252,205,183);
quad(222,245,238,245,235,260,225,260);
//body
quad(215,265,245,265,240,295,220,295);
//arm
rect(215,235+mouseY/15,218,265+mouseY/15);
rect(242,240+mouseY/15,245,270+mouseY/15);
//pant
fill(255);
quad(220,295,240,295,245,315,215,315);
//leg
rect(223,315,228,335);
rect(235,315,240,335);
//foot
rect(222,335,229,340);
rect(234,335,241,340);
//shield
stroke(172,127,89);
strokeWeight(3);
fill(198,154,107);
quad(212,235+mouseY/15,207,280+mouseY/15,223,280+mouseY/15,218,235+mouseY/15);
//weapon
stroke(0);
strokeWeight(3);
line(245,215+mouseY/15,245,310+mouseY/15);
quad(245,215+mouseY/15,243,220+mouseY/15,245,215+mouseY/15,247,220+mouseY/15);
//eyes&mouth
strokeWeight(2);
line(225,250,226,250);
line(233,250,234,250);
line(228,255,232,255);
//General//
//head
noStroke();
fill(80,79,75);
quad(180,350,170,360,170,400,250,400);
quad(220,320,180,350,250,400,250,350);
quad(190,310,140,330,150,350,180,350);
triangle(190,310,180,350,220,320);
triangle(200,260,190,310,220,330);
triangle(220,260,200,320,220,320);
//inside
stroke(0);
strokeWeight(2);
line(180,350,170,360);
line(170,360,170,400);
line(180,355,175,360);
line(175,360,175,400);
line(205,350,210,360);
line(210,360,210,400);
line(210,350,215,360);
line(215,360,215,400);
strokeWeight(1);
line(180,350,200,400);
line(200,350,210,370);
line(210,350,220,340);
line(220,340,220,330);
//eye
noStroke();
fill(255);
quad(180,320,170,325,190,325,190,320);
//arm(moves vertically when mouse moves vertically)
fill(80,79,75);
rect(280,250+mouseY/2,310,260+mouseY/2);
rect(270,260+mouseY/2,310,280+mouseY/2);
quad(280,280+mouseY/2,290,340+mouseY/2,320,330+mouseY/2,300,280+mouseY/2);
quad(320,330+mouseY/2,320,350+mouseY/2,330,350+mouseY/2,330,340+mouseY/2);
triangle(320,330+mouseY/2,290,340+mouseY/2,320,350+mouseY/2);
quad(290,340+mouseY/2,260,400+mouseY/2,300,400+mouseY/2,320,350+mouseY/2);
}
//when mouse clicked,show text and gerenal's eye change color
void mousePressed() {
//set the framerate to 5 to keep the color change for longer time
frameRate(5);
fill(255,0,0);
quad(180,320,170,325,190,325,190,320);
println("For Egypt!!!!");
}