Nyan Luis

What if I was an annoying cat? And we couldn’t communicate? And all I could say was meow?

My version of the super famous Nyan Cat… If only I could add music to mine 🙁 🙁

Here’s the code XD XD XD

int quadrant=1; // for cat's orbit
int x=0; 
int y=-100; 
PImage cat;
PImage rain;
 
void setup() {
  size(800, 600);
  background(0, 68, 120); 
  noFill();
  stroke(0);
  smooth();
  frameRate(24); 
  cat = loadImage("cat.png");
  rain = loadImage("rain.png");
} 
 
void draw() {
  background(0, 68, 120);
  stroke(255);
  fill(255);
  //random starzzzzz
  for (int z=0;z<30;z++) { 
    float zx=random(800);
    float zy=random(800);
    float diameter=random(10);
    int(zx); 
    int(zy);
    int(diameter);
    ellipse(zx, zy, diameter, diameter);
  }
  
  if (mousePressed == true) {
    translate(mouseX-50, mouseY-50);
    image(rain, 30, 5, -1000, 48.644); // wider rain 
    image(cat, 0, 0);
  }
  else {
    switch (quadrant) {
    case 1:
      if (x<=100) {
        x+=6;
        y+=6;
      }
      else {
        quadrant = 2;
      }
      break;
    case 2:
      if (x>0) {
        x-=12;
        y+=12;
      }
      else {
        quadrant = 3;
      }
      break;
    case 3:
      if (x>-100) {
        x-=12;
        y-=12;
      }
      else {
        quadrant = 4;
      }
      break;
    case 4:
      if (x<=0) {
        x+=12;
        y-=12;
      }
      else {
        quadrant = 1;
      }
      break;
    }
    translate(mouseX-50+x, mouseY-50+y); 
    image(rain, 30, 5, -1000, 48.644); 
    image(cat, 0, 0);
  } 
}

 

 

Leave a Reply