//Simple creature animation -- Zoe Wood April 2015 for PCS 5th grade
//Students will fill in the drawCreature method with their creature data when complete

int modelX, modelY;
int tx, ty;
float modelRot;
int bottom, left, top, right;

void setup() {
  size(600, 400);
  background(76, 227, 200);
  modelX = 540/2;
  modelY = 540/2;

  modelRot = 0;
  bottom = height-70;
  left = 70;
  top = 70;
  right = width-70;
  tx = right;
  ty = bottom;
}

//TODO - students should fill in with their shape - created using digital graph paper
//creature should be within 0-540 in both x and y
//creature should be centered around {260, 260} -- leave all model transforms
void drawCreature(int tx, int ty) {

  pushMatrix();
  translate(tx, ty);
  rotate(modelRot);
  scale(0.3);
  translate(-modelX, - modelY);
  
  //TODO - fill in with beginShape and vertices
  
 
 
   //-----be sure to leave the rest of the code in place - do not edit below this line!!!
  popMatrix();
}

void draw() {

  //TODO - change the background color if you want
  background(76, 227, 200);

  //Do not change the animation variables
  if (ty == bottom && tx > left) {
    modelRot = 0;
    tx -= 1;
  } 
  if (tx == left && ty > top) {
    modelRot = PI/2;
    ty -=1;
  } 
  if (ty == top && tx < right) {
    modelRot = -PI;
    tx += 1;
  }
  if (tx == right && ty < bottom) {
    modelRot = -PI/2;
    ty += 1;
  }
  drawCreature(tx, ty);
}