까진 늑대개님의 이글루입니다

byunghwa96.egloos.com

포토로그



2019_1 Interactive Video Week 5


PImage conan;
PImage cat;
PImage bed;
PImage flower;
PImage fridge;
PImage sofa;
PImage toilet;
PImage cat2;
float conanX = -100;
float conanY = 500;
float bedY = 180;
float sofaY = 30;
float flowerY = 500;
float fridgeY = 500;
float toiletY = 50;
float cat2X = -100;
float cat2Y = 0;

void setup()
{
 size(1500, 1000);
 conan = loadImage("conan.png");
 cat = loadImage("cat.png");
 cat2 = loadImage("cat2.png");
 bed = loadImage("bed.png");
 flower = loadImage("flower.png");
 fridge = loadImage("fridge.png");
 sofa = loadImage("sofa.png");
 toilet = loadImage("toilet.png");
}

void draw()
{
 background(225); 
 
   if (mousePressed == true && conanY >= -100 && conanY <= 350 && conanX >= 800 && conanX <= 1200){
   image(cat2, cat2X, cat2Y);
   cat2X = cat2X + 15;
       if(cat2Y == 0){
        cat2Y = 50; 
       } else if(cat2Y == 50) {
         cat2Y = 0;
       }
           if(cat2X >= 1100){
             cat2X = -100;
           }
   textSize(100);
   text("LEAVE ME ALONE!!", 0, 100);
   text("LEAVE ME ALONE!!", 0, 200);
   text("LEAVE ME ALONE!!", 0, 300);
   text("LEAVE ME ALONE!!", 0, 400);
   text("LEAVE ME ALONE!!", 0, 500);
   text("LEAVE ME ALONE!!", 0, 600);
   text("LEAVE ME ALONE!!", 0, 700);
   text("LEAVE ME ALONE!!", 0, 800);
   text("LEAVE ME ALONE!!", 0, 900);
   text("LEAVE ME ALONE!!", 0, 1000);

  } else {
   pushMatrix();
   translate(1200, 100);
   rotate(PI/4);
   scale(0.6);
   image(cat, 100, 100);
   popMatrix();
   
 pushMatrix();
 scale(0.6);
 image(bed, 50, bedY);
 popMatrix();
 pushMatrix();
 translate(450, sofaY);
 scale(0.3);
 image(sofa, 100, 100);
 popMatrix();
 pushMatrix();
 translate(1000, toiletY);
 scale(0.45);
 image(toilet, 100, 100);
 popMatrix();
 pushMatrix();
 translate(1000, fridgeY);
 scale(0.44);
 image(fridge, 100, 100);
 popMatrix();
 pushMatrix();
 translate(550, flowerY);
 scale(0.45);
 image(flower, 100, 100);
 popMatrix();
 pushMatrix();
 translate(conanX, conanY);
 scale(1.2);
 image(conan, 100, 100);
 popMatrix();
 
 if(keyPressed){
 textSize(70);
 text("I WILL FIND YOU", 100, 900);
 }
 
    if(keyPressed == true) {
    if(keyCode == RIGHT) {
      conanX = conanX + 30;
    } else if (keyCode == LEFT) {
      conanX = conanX - 30;
    } else if (keyCode == UP) {
      conanY = conanY - 30;
    } else if (keyCode == DOWN) {
      conanY = conanY + 30;
    }
  }
  
  if(conanX <= -130) {
    conanX = -130;
  }
  if(conanX >= 1170) {
    conanX = 1170;
  }
  if(conanY <= -100) {
    conanY = -100;
  }
  if(conanY >= 500) {
    conanY = 500;
  }
  
  if(conanY >= 80 && conanY <= 350 && conanX >= -100 && conanX <= 320){
    bedY = 30;
  } else bedY = 180;
  
  if(conanY >= -40 && conanY <= 200 && conanX >= 260 && conanX <= 800){
   sofaY = -20;
  } else sofaY = 30;
  
  if(conanY >= 410 && conanY <= 500 && conanX >= 350 && conanX <= 780){
   flowerY = 350;
  } else flowerY = 500;
  
  if(conanY >= 410 && conanY <= 500 && conanX >= 800 && conanX <= 1200){
   fridgeY =  350;
  } else fridgeY = 500;
  
  if(conanY >= -100 && conanY <= 350 && conanX >= 800 && conanX <= 1200){
   toiletY =  -100;
  } else toiletY = 50;
 
  }
  
}


덧글

댓글 입력 영역