/* done!! victoria Plermo
W= up
S= down*/
//lets declate some variables!
int score = 0;
float playerX = 30;
float playerY = 80;
//music note 1
float musicNoteSpeed1 = 0.5;
float musicX1 = 430;
float musicY1 = 30;
//music note2
float musicNoteSpeed2 = 0.7;
float musicX2 = 430;
float musicY2 = 80;
//music note 3
float musicNoteSpeed3 = 1;
float musicX3 = 430;
float musicY3 = 130;
int r = (int) random (10,240) ;
int g = (int) random (10,240) ;
int b = (int) random (10,240) ;
int backgroundNoteX = (int) random (30,370);
int backgroundNoteY = (int) random (180,370);
int backgroundNoteX2 = (int) random (30,370);
int backgroundNoteY2 = (int) random (180,370);
int r2 = (int) random (10,240) ;
int g2 = (int) random (10,240) ;
int b2 = (int) random (10,240) ;
int backgroundNoteX3 = (int) random (30,370);
int backgroundNoteY3 = (int) random (180,370);
int r3 = (int) random (10,240) ;
int g3 = (int) random (10,240) ;
int b3 = (int) random (10,240) ;
//setup stuff
void setup(){
size(400,400);
frameRate(60);
}
// where the actual things are put on screen (all functions are called here)
void draw(){
background(243,249,139);
staff();
musicNoteMoving1();
musicNoteMoving2();
musicNoteMoving3();
collisions();
player();
if (score<=10){
personV1();
}
if (score>10 && score <=20){
personV2();
}
if (score>20){
personV3();
}
}
// lets key press!
void keyPressed(){
playerMovement();
}
//how the music notes move so much movement
void musicNoteMoving1 (){
drawMusicNote1();
musicX1 = musicX1-musicNoteSpeed1;
if (musicX1<=-40){
musicX1= 430;
musicNoteSpeed1= musicNoteSpeed1 - random(0.2,0.3);
}
}
void musicNoteMoving2 (){
drawMusicNote2();
musicX2 = musicX2-musicNoteSpeed2;
if (musicX2<=-40){
musicX2= 430;
musicNoteSpeed2= musicNoteSpeed2 - random(0.1,0.2);
}
}
void musicNoteMoving3 (){
drawMusicNote3();
musicX3 = musicX3-musicNoteSpeed3;
if (musicX3<=-40){
musicX3= 430;
musicNoteSpeed3= musicNoteSpeed3 - random(0.01,0.15);
}
}
//drawing things!
void player(){
noStroke();
fill(2,189,182);
rectMode(CENTER);
rect(playerX,playerY,10,10);
}
void drawMusicNote3 (){
noStroke();
fill (211,130,237);
ellipseMode (CENTER);
ellipse (musicX3+10,musicY3,20,20);
stroke(211,130,237);
strokeWeight(3);
line(musicX3 + 20, musicY3 + 5, musicX3 + 20 , musicY3 - 30);
}
void drawMusicNote2 (){
noStroke();
fill (211,130,237);
ellipseMode (CENTER);
ellipse (musicX2+10,musicY2,20,20);
stroke(211,130,237);
strokeWeight(3);
line(musicX2 + 20, musicY2 + 5, musicX2 + 20, musicY2 - 30);
}
void drawMusicNote1 (){
noStroke();
fill (211,130,237);
ellipseMode (CENTER);
ellipse (musicX1+10,musicY1,20,20);
stroke(211,130,237);
strokeWeight(3);
line(musicX1 + 20, musicY1 + 5, musicX1 +20, musicY1 - 30);
}
void staff(){
for (int i= 0 ; i <= 2 ; i++){
stroke(0);
strokeWeight(2);
line (0,30+50*i,400,30+50*i);
}
}
void personV1(){
//bottom arms
fill(30,200,194);
triangle (width/3,340,160,370,120,460);
triangle (width/3*2,340,240,370,width/3*2+10,460);
//body+head
noStroke();
fill (57,227,221);
ellipseMode (CENTER);
ellipse (width/2,10*cos(frameCount/20.0)+220,80,80);
ellipse (width/2,340,7*cos(frameCount/20.0)+140,7*cos(frameCount/20.0)+100);
//top arms
triangle (7*cos(frameCount/20.0)+width/4,300,120,430,150,430);
triangle (7*sin(frameCount/20.0)+width/4*3,300,280,430,250,430);
for (int n= 0 ; n <= 2 ; n++){
noStroke();
fill (r,g,b);
ellipseMode (CENTER);
ellipse (backgroundNoteX + n*20,backgroundNoteY +n*20,20,20);
strokeWeight(3);
stroke(r,g,b);
line(backgroundNoteX+n*20 + 10, backgroundNoteY+n*20 + 5, backgroundNoteX+n*20 +10, backgroundNoteY+n*20 - 30);
}
}
void personV2(){
//bottom arms
fill(30,200,194);
triangle (width/3,340,160,370,120,460);
triangle (width/3*2,340,240,370,width/3*2+10,460);
//body+head
noStroke();
fill (57,227,221);
ellipseMode (CENTER);
ellipse (width/2,10*cos(frameCount/20.0)+220,80,80);
ellipse (width/2,340,7*cos(frameCount/20.0)+140,7*cos(frameCount/20.0)+100);
//top arms
triangle (7*cos(frameCount/20.0)+width/4,300,120,430,150,430);
triangle (7*sin(frameCount/20.0)+width/4*3,300,280,430,250,430);
for (int n= 0 ; n <= 2 ; n++){
noStroke();
fill (r,g,b);
ellipseMode (CENTER);
ellipse (backgroundNoteX + n*20,backgroundNoteY +n*20,20,20);
strokeWeight(3);
stroke(r,g,b);
line(backgroundNoteX+n*20 + 10, backgroundNoteY+n*20 + 5, backgroundNoteX+n*20 +10, backgroundNoteY+n*20 - 30);
}
for (int n= 0 ; n <= 3 ; n++){
noStroke();
fill (r2,g2,b2);
ellipseMode (CENTER);
ellipse (backgroundNoteX2 + n*20,backgroundNoteY2 +n*20,20,20);
strokeWeight(3);
stroke(r2,g2,b2);
line(backgroundNoteX2+n*20 + 10, backgroundNoteY2+n*20 + 5, backgroundNoteX2+n*20 +10, backgroundNoteY2+n*20 - 30);
}
}
void personV3(){
//bottom arms
fill(30,200,194);
triangle (width/3,340,160,370,120,460);
triangle (width/3*2,340,240,370,width/3*2+10,460);
//body+head
noStroke();
fill (57,227,221);
ellipseMode (CENTER);
ellipse (width/2,10*cos(frameCount/20.0)+220,80,80);
ellipse (width/2,340,7*cos(frameCount/20.0)+140,7*cos(frameCount/20.0)+100);
//top arms
triangle (7*cos(frameCount/20.0)+width/4,300,120,430,150,430);
triangle (7*sin(frameCount/20.0)+width/4*3,300,280,430,250,430);
for (int n= 0 ; n <= 2 ; n++){
noStroke();
fill (r,g,b);
ellipseMode (CENTER);
ellipse (backgroundNoteX + n*20,backgroundNoteY +n*20,20,20);
strokeWeight(3);
stroke(r,g,b);
line(backgroundNoteX+n*20 + 10, backgroundNoteY+n*20 + 5, backgroundNoteX+n*20 +10, backgroundNoteY+n*20 - 30);
}
for (int n= 0 ; n <= 3 ; n++){
noStroke();
fill (r2,g2,b2);
ellipseMode (CENTER);
ellipse (backgroundNoteX2 + n*20,backgroundNoteY2 +n*20,20,20);
strokeWeight(3);
stroke(r2,g2,b2);
line(backgroundNoteX2+n*20 + 10, backgroundNoteY2+n*20 + 5, backgroundNoteX2+n*20 +10, backgroundNoteY2+n*20 - 30);
}
for (int n= 0 ; n <= 4 ; n++){
noStroke();
fill (r3,g3,b3);
ellipseMode (CENTER);
ellipse (backgroundNoteX3 - n*20,backgroundNoteY3 -n*20,20,20);
strokeWeight(3);
stroke(r3,g3,b3);
line(backgroundNoteX3-n*20 + 10, backgroundNoteY3-n*20 + 5, backgroundNoteX3-n*20 +10, backgroundNoteY3-n*20 - 30);
}
}
//Collisions!!
void collisions(){
if (playerX > musicX1 -5 && playerX < musicX1 +5 && playerY > musicY1 -5 && playerY < musicY1 +5){
score++;
musicX1= 430;
musicNoteSpeed1= musicNoteSpeed1 + random(0.2,0.3);
}
if (playerX > musicX2 -5 && playerX < musicX2 +5 && playerY > musicY2 -5 && playerY < musicY2 +5){
score++;
musicX2= 430;
musicNoteSpeed2= musicNoteSpeed2 + random(0.1,0.2);
}
if (playerX > musicX3 -5 && playerX < musicX3 +5 && playerY > musicY3 -5 && playerY < musicY3 +5){
score++;
musicX3= 430;
musicNoteSpeed3= musicNoteSpeed3 + random(0.01,0.15);
}
}
// lets do player movement
void playerMovement(){
if(key =='w'){
playerY -= 50;
}
if (playerY < 30){
playerY= 30;
}
if(key =='s'){
playerY += 50;
}
if (playerY > 130){
playerY = 130;
}
}