Help with small Project
int Y = 100; //y-coordinate of target
int Yspeed = 10; // speed od target
int x = 25; // x-coordinate of shapes
int y = 25; // y-coordinate of shapes
int z = 25; // x-coordinate of bullet
int h = 25;
float score = 0; // score
{
size(800,500);
}
stroke (0);
fill (210,50,100);
rect (x+18,y+50,15,60);
fill (245,140,140);
ellipse(x+25,y+30,50,50); // Player
rect (x+33,y+57,40,7);
quad (x+18,y+69,x+18,y+57,x-2,y+103,x+3,y+103);
fill (0);
quad (x+27,y+110,x+33,y+110,x+40,y+155,x+35,y+155);
quad (x+25,y+110,x+18,y+110,x+5,y+155,x+10,y+155);
fill (0);
rect (x+65,y+52,20,5);
rect (x+65,y+65,5,4);
triangle(z+86,y+52,z+86,y+56,z+98,y+54);
noStroke();
fill(255,10);
rect(20,0,width,height);
// Add the current speed to the location.
Y = Y + Yspeed;
if ((Y > height) || (Y < 0)) {
Yspeed = Yspeed * -1;
}
// Display at x,y location
fill(0);
rect(X,Y,30,60);
}
if (keyCode == CONTROL){ // shooting action
z=z+118;}
else if (keyCode == ALT) { // reload
z=25+0;}
}
text("Score:", 50, 480); //Score Text
fill(0, 153, 102);
text(score, 140, 480);
if(y == Y ||y == Y+1 || y ==Y+2|| y ==Y+3||y == Y+4 || y ==Y+5||y == Y+6||y == Y+7||y == Y+8||y == Y+9||y == Y+10|| y ==Y+11||y == Y+12||y == Y+13||y == Y+14||y == Y+15|| y ==Y+17||y == Y+18||y == Y+19||y == Y+20||y == Y+22|| y ==Y+23||y == Y+24||y == Y+25|| y ==Y+26||y == Y+27||y == Y+28||y == Y+29 || y ==Y+30){
score=score+0.33333333333333333333333333333333;}
}
void keyPressed() {
if (key == CODED) {
if (keyCode == UP) { //Move up
y=y-40;
} else if (keyCode == DOWN) { // Move Down
y=y+40;
}
}}