Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
//variables used, less than reccomended as more had a tendency to break the game

boolean collisionWall = false;
boolean finish = false;
float x = 0;


void setup(){
  size(400,400);
 
  println("traverse the maze, ignite the brazier");
  

}

void draw(){
    background(0);
   
    //moving shadows
       x=0;
       while (x < width) {
         x = x + 10;
         fill(30,30,30,50);        
         ellipse(x, random(0,400), random(10,20), random(10,20));
       frameRate(20);        
 }   
       
//torch handle & cloth drawing

fill(180,130,0,100);
rect(mouseX,mouseY-20,5,30);
fill(100,100,100);
rect(mouseX,mouseY-20,5,5);


//torch illumination around mouse

noStroke();
fill(255,170,0,90);
triangle(mouseX,mouseY + random(-46,-34),mouseX+3,mouseY-15,mouseX-3,mouseY-15);
triangle(mouseX,mouseY +random(-52,-38),mouseX +random(6,9), mouseY-13,mouseX + random(1,5), mouseY-13);
triangle(mouseX + random(3,6), mouseY + random(-55,-45), mouseX - random(2,-5), mouseY - random(10,14),mouseX + 5, mouseY-random(10,12));
fill(255,255,0,60);

ellipse(mouseX+3,mouseY-20,175,175);

 
  //finish plate drawing
fill(0);
rect(180,180,40,40);

//finishing fire animation & check for finish

if (finish){
  background(100,100,0);
  println("you throw your torch into the braizer, illuminating the area");
 fill(255,120,0,99);
  triangle(random(182,180),random(220,222),random(200,202),random(230,232),random(196,200),random(150,160));
   triangle(random(199,197),random(230,227),random(218,215),random(220,222),random(195,193),random(153,160));
    triangle(random(185,187),random(220,222),random(210,212),random(220,222),random(190,195),random(170,190));
      triangle(random(192,190),random(210,208),random(210,212),random(225,222),random(195,197),random(160,180));
      fill(255,220,0,99);
        triangle(random(182,180),random(220,222),random(200,202),random(230,232),random(195,197),random(160,180));
         triangle(random(198,200),random(228,230),random(219,217),random(220,222),random(195,197),random(160,180));

}
  
  //drawing the walls
//outerwalls/wall#1

  fill(0);
  rect(20,20,100,20);
  rect(20,20,20,240);
  rect(20,280,20,100);
  rect(20,360,360,20);
  rect(360,320,20,60);
  rect(360,20,20,280);
  rect(140,20,220,20);
  
//blocks#1  
  rect(40,100,20,20);
  rect(80,340,20,20);
  rect(340,220,20,20);
  
//wall#2
  rect(60,60,180,20);
  rect(60,60,20,80);
  rect(60,160,20,180);
  rect(60,320,80,20);
  rect(160,320,180,20);
  rect(320,280,20,40);
  rect(320,60,20,200);
  rect(260,60,80,20);
 
//blocks#2
  rect(200,80,20,20);
  rect(300,180,20,20);
  rect(180,300,20,20);
  rect(80,180,20,20);
  
//wall#3
  rect(100,100,60,20);
  rect(100,100,20,120);
  rect(100,240,20,60);
  rect(100,280,100,20);
  rect(220,280,80,20);
  rect(280,160,20,140);
  rect(280,100,20,40);
  
//blocks#3
  rect(180,100,120,20);
  rect(120,160,20,20);
  rect(160,260,20,20);
  rect(260,180,20,20);
  
//walls#4
  rect(240,140,20,60);
  rect(140,140,120,20);
  rect(140,140,20,120);
  rect(140,240,120,20);
  rect(240,220,20,40);
  


//check for any collisions

if (collisionWall){
  fill(0,0,0);
  rect(0,0,400,400);  
 println("your fire is extinguished and you're consumed by the dark");
}

//finish requirements
if (mouseX > 180 && mouseX < 220 && mouseY > 180 && mouseY < 220){
  finish = true;
}

//wall collisions #1


if (mouseX > 20 && mouseX < 120 && mouseY > 20 && mouseY < 40 || mouseX > 140 && mouseX < 380 && mouseY > 20 && mouseY < 40 ||
mouseX > 360 && mouseX < 380 && mouseY > 20 && mouseY < 300 || mouseX > 360 && mouseX < 380 && mouseY > 320 && mouseY < 380 || 
mouseX > 20 && mouseX < 380 && mouseY > 360 && mouseY < 380 || mouseX > 20 && mouseX < 40 && mouseY > 280 && mouseY < 380 ||
mouseX > 20 && mouseX < 40 && mouseY > 20 && mouseY < 260 ||

//block collisions #1

mouseX > 40 && mouseX < 60 && mouseY > 100 && mouseY < 120 || mouseX > 80 && mouseX < 100 && mouseY > 340 && mouseY < 360 ||
mouseX > 340 && mouseX < 360 && mouseY > 220 && mouseY < 240 || 

//wall collisions #2

mouseX > 60 && mouseX < 80 && mouseY > 60 && mouseY < 140 || mouseX > 60 && mouseX < 80 && mouseY > 160 && mouseY < 340 ||
mouseX > 60 && mouseX < 140 && mouseY > 320 && mouseY < 340 || mouseX > 180 && mouseX < 340 && mouseY >320 && mouseY < 340 ||
mouseX > 320 && mouseX < 340 && mouseY > 280 && mouseY < 340 || mouseX > 320 && mouseX < 340 && mouseY > 60 && mouseY < 260 ||
mouseX > 260 && mouseX < 340 && mouseY > 60 && mouseY < 80 || mouseX > 60 && mouseX < 240 && mouseY > 60 && mouseY < 80 ||

//block collisions #2

mouseX > 80 && mouseX < 100 && mouseY > 180 && mouseY < 200 || mouseX > 180 && mouseX < 200 && mouseY > 300 && mouseY < 320 ||
mouseX > 300 && mouseX < 320 && mouseY >180 && mouseY <200 || mouseX > 200 && mouseX < 220 && mouseY > 80 && mouseY < 100 ||

//wall collisions #3

mouseX > 100 && mouseX < 120 && mouseY > 100 && mouseY < 220 || mouseX > 100 && mouseX < 120 && mouseY > 240 && mouseY < 300 ||
mouseX > 100 && mouseX < 200 && mouseY > 280 && mouseY < 300 || mouseX > 220 && mouseX < 300 && mouseY > 280 && mouseY < 300 ||
mouseX > 280 && mouseX < 300 && mouseY > 160 && mouseY < 300 || mouseX > 280 && mouseX < 300 && mouseY > 100 && mouseY < 140 ||
mouseX > 180 && mouseX < 300 && mouseY > 100 && mouseY < 120 || mouseX > 100 && mouseX < 160 && mouseY > 100 && mouseY < 120 ||

//block collisions #3

mouseX > 120 && mouseX < 140 && mouseY > 160 && mouseY < 180 || mouseX > 160 && mouseX < 180 && mouseY > 260 && mouseY < 280 ||
mouseX > 260 && mouseX < 280 && mouseY > 180 && mouseY < 200 ||

//wall collisions #4

mouseX > 140 && mouseX < 160 && mouseY > 140 && mouseY < 260 || mouseX > 140 && mouseX < 260 && mouseY > 240 && mouseY < 260 ||
mouseX > 240 && mouseX < 260 && mouseY > 140 && mouseY < 200 || mouseX > 140 && mouseX < 260 && mouseY > 140 && mouseY < 160){
  //if these boundaries are met then switch collisionWall to true 
    collisionWall = true;
}

}