Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int level = -1;
- int lives = 3;
- String Start = "Click here Start";
- String Reset = "Press R to Restart!";
- String Cheat = "Want to cheat? \n Type 'F' \n to skip to \n the end!";
- String life5 = "You have '5' Lives!";
- String life4 = "You have '4' Lives!";
- String life3 = "You have '3' Lives!";
- String life2 = "You have '2' Lives!";
- String life1 = "You have '1' Life!";
- String lifes = life3;
- PImage maze;
- PImage maze2;
- PImage maze3;
- PImage spc;
- PImage etype;
- PImage star;
- Enemy enemy1 = new Enemy(100,100,20);
- Enemy enemy2 = new Enemy(0,200,40);
- PImage win;
- PImage start;
- PImage loser;
- PImage bomb;
- PImage grenade;
- PImage settinglogo;
- PImage nathan;
- color bColor = color(0,0,0);
- int settings = 0;
- int eimage = 1;
- Ball ball1 = new Ball('w', 's', 'a', 'd', 10000 , 10 , 10, 7, 5, 5);
- void setup(){
- size(800,600);
- maze = loadImage("maze.png");
- maze2 = loadImage("maze2.jpg");
- maze3 = loadImage("maze3.gif");
- win = loadImage("win.jpg");
- loser = loadImage("loser.jpg");
- settinglogo = loadImage("settinglogo.png");
- spc = loadImage("spc.png");
- start = loadImage("start.gif");
- etype = loadImage("etype.png");
- star = loadImage("star.png");
- nathan = loadImage("nathan.jpg");
- bomb = loadImage("bomb.png");
- grenade = loadImage("greande.png");
- fill(0);
- textSize(10);
- }
- void draw(){
- if (level == -1){
- lives = 3;
- settings = -1;
- background(0,255,0);
- image(settinglogo,250,400,50,50);
- image(start,100,150,400,250);
- fill(0);
- text(Reset,620,25);
- text(lifes,620,50);
- }
- if (level == 1){
- settings = -1;
- image(maze,0,0,600,600);
- enemy1.show();
- enemy1.move3(millis());
- fill(bColor);
- fill(0,255,0);
- rect(600,0,800,600);
- fill(0);
- text(Reset,620,25);
- text(lifes,620,50);
- text(Cheat,620,75);
- textSize(10);
- }
- if (level == 2){
- settings = -1;
- image(maze2,0,0,600,600);
- fill(bColor);
- enemy2.show();
- enemy2.move2(millis());
- fill(0,255,0);
- rect(600,0,800,600);
- fill(0);
- text(Reset,620,25);
- text(lifes,620,50);
- text(Cheat,620,75);
- textSize(10);
- }
- if (level == 3){
- settings = -1;
- image(maze3,0,0,600,600);
- fill(bColor);
- enemy1.show();
- enemy1.move(millis());
- fill(0,255,0);
- rect(600,0,800,600);
- fill(0);
- text(Reset,620,25);
- text(lifes,620,50);
- text(Cheat,620,75);
- textSize(10);
- }
- if (level == 4){
- settings = -1;
- image(win,0,0,600,600);
- }
- if(keyPressed){
- if (key == 'r'){
- level = -1;
- ball1 = new Ball('w', 's', 'a', 'd', 10000 , 10 , 10, 7, 5, 5);
- lives = 3;
- }
- if (key == 'f' && level == 1){
- ball1 = new Ball('w', 's', 'a', 'd', width-490 , height-25 , 8, 3, 5, 5);
- }
- if (key == 'f' && level == 2){
- ball1 = new Ball('w', 's', 'a', 'd', width-430 , height-50 , 8, 3, 5, 5);
- }
- if (key == 'f' && level == 3){
- ball1 = new Ball('w', 's', 'a', 'd', width-760 , height-400 , 8, 3, 5, 5);
- }
- }
- if (level == -1 && mousePressed == true && mouseX > 100 && mouseX < 500 && mouseY > 150 && mouseY < 400){
- level = 1;
- image(maze,0,0,600,600);
- noStroke();
- fill(bColor);
- ball1 = new Ball('w', 's', 'a', 'd', 280 , 10 , 8, 3, 5, 5);
- }
- if (level == -1 && mousePressed == true && mouseX > 200 && mouseX < 300 && mouseY > 350 && mouseY <450){
- level = -2;
- }
- if (level == -2){
- background(255);
- image(etype,60,200,550,280);
- image(spc,75,40,450,100);
- fill(255);
- noStroke();
- rect(20,60,100,100);
- rect(20,40,500,18);
- fill(150,100,255);
- noStroke();
- ellipse(150,150,25,25);
- fill(0,255,255);
- ellipse(250,150,25,25);
- fill(0,0,255);
- ellipse(350,150,25,25);
- fill(150,255,0);
- ellipse(450,150,25,25);
- //
- noStroke();
- image(star,150,350,25,25);
- image(nathan,250,350,25,25);
- image(bomb,350,350,25,25);
- image(grenade,450,350,25,25);
- image(settinglogo,250,450,50,50);
- }
- if (level == -2 && mousePressed == true && mouseX > 145 && mouseX < 170 && mouseY > 145 && mouseY <170){
- settings = 1;
- }
- if (level == -2 && mousePressed == true && mouseX > 145 && mouseX < 170 && mouseY > 345 && mouseY <370){
- eimage = 1;
- }
- if (level == -2 && mousePressed == true && mouseX > 245 && mouseX < 270 && mouseY > 345 && mouseY <370){
- eimage = 2;
- }
- if (level == -2 && mousePressed == true && mouseX > 345 && mouseX < 370 && mouseY > 345 && mouseY <370){
- eimage = 3;
- }
- if (level == -2 && mousePressed == true && mouseX > 445 && mouseX < 470 && mouseY > 345 && mouseY <370){
- eimage = 4;
- }
- if (level == -2 && mousePressed == true && mouseX >= 245 && mouseX <= 270 && mouseY >= 145 && mouseY <= 170){
- settings = 2;
- }
- if (level == -2 && mousePressed == true && mouseX >= 345 && mouseX <= 370 && mouseY >= 145 && mouseY <= 170){
- settings = 3;
- }
- if (level == -2 && mousePressed == true && mouseX >= 445 && mouseX <= 470 && mouseY >= 145 && mouseY <= 170){
- settings = 4;
- }
- if (level == -2 && mousePressed == true && mouseX >= 200 && mouseX <= 300 && mouseY >= 450 && mouseY <= 550){
- level = -1;
- }
- if (settings == 1){
- bColor = color(150,100,255);
- fill(150,100,255);
- stroke(0);
- strokeWeight(7);
- ellipse(150,150,25,25);
- noStroke();
- fill(255);
- rect(20,60,100,100);
- rect(20,40,500,18);
- }
- if (settings == 2){
- fill(150,100,255);
- noStroke();
- ellipse(150,150,25,25);
- bColor = color(0,255,255);
- fill(0,255,255);
- stroke(0);
- strokeWeight(7);
- ellipse(250,150,25,25);
- noStroke();
- fill(255);
- rect(20,60,100,100);
- rect(20,40,500,18);
- }
- if (settings == 3){
- fill(150,100,255);
- noStroke();
- ellipse(150,150,25,25);
- fill(0,255,255);
- ellipse(250,150,25,25);
- bColor = color(0,0,255);
- fill(0,0,255);
- stroke(0);
- strokeWeight(7);
- ellipse(350,150,25,25);
- noStroke();
- fill(255);
- rect(20,60,100,100);
- rect(20,40,500,18);
- }
- if (settings == 4){
- fill(150,100,255);
- noStroke();
- ellipse(150,150,25,25);
- fill(0,255,255);
- ellipse(250,150,25,25);
- fill(0,0,255);
- ellipse(350,150,25,25);
- bColor = color(150,255,0);
- fill(150,255,0);
- stroke(0);
- strokeWeight(7);
- ellipse(450,150,25,25);
- noStroke();
- fill(255);
- rect(20,60,100,100);
- rect(20,40,500,18);
- }
- if (settings == 5){
- fill(150,100,255);
- noStroke();
- ellipse(150,150,25,25);
- fill(0,255,255);
- ellipse(250,150,25,25);
- fill(0,0,255);
- ellipse(350,150,25,25);
- bColor = color(150,255,0);
- fill(150,255,0);
- stroke(0);
- strokeWeight(7);
- ellipse(450,150,25,25);
- noStroke();
- fill(255);
- rect(20,60,100,100);
- rect(20,40,500,18);
- }
- if (ball1.isFinished(width-510,height-25,50,50) && level == 1 ){
- level = 2;
- fill(bColor);
- ball1 = new Ball('w', 's', 'a', 'd', 270 , 10 , 10, 7, 5, 5);
- lives = lives+1;
- }
- if (ball1.isFinished(width-430,height-25,50,50) && level == 2 ){
- level = 3;
- fill(bColor);
- ball1 = new Ball('w', 's', 'a', 'd', 475 , 10 , 10, 4, 5, 5);
- lives = lives+1;
- }
- if (ball1.isFinished(width-830,height-400,50,50) && level == 3 ){
- level = 4;
- fill(bColor);
- ball1 = new Ball('w', 's', 'a', 'd', 10000,10000 ,0, 0, 0, 0);
- lives = lives+1;
- }
- if (ball1.touchingWall() && level == 1){
- level = 1;
- fill(0,255,0);
- rect(600,0,800,600);
- lives = lives -1;
- ball1 = new Ball('w', 's', 'a', 'd', 280 , 10 , 8, 3, 5, 5);
- }
- if (ball1.touchingWall() && level == 2){
- level = 2;
- fill(0,255,0);
- rect(600,0,800,600);
- lives = lives -1;
- ball1 = new Ball('w', 's', 'a', 'd', 270 , 10 , 10, 4, 5, 5);
- }
- if (ball1.touchingWall() && level == 3){
- level = 3;
- fill(0,255,0);
- rect(600,0,800,600);
- lives = lives -1;
- ball1 = new Ball('w', 's', 'a', 'd', 475 , 10 , 10, 4, 5, 5);
- }
- if (ball1.loseGame()){
- level = 5;;
- }
- if(level == 5){
- image(loser,0,0,800,600);
- ball1 = new Ball('w', 's', 'a', 'd', 10000 , 10 , 10, 7, 5, 5);
- }
- if(lives == 1){
- lifes = life1;
- }
- if(lives == 2){
- lifes = life2;
- }
- if(lives == 3){
- lifes = life3;
- }
- if(lives == 4){
- lifes = life4;
- }
- if(lives == 5){
- lifes = life5;
- }
- ball1.show();
- ball1.move();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement