Pig Eatin Time! One

Be a pig, and eat healthy, be rich, all you want with a pig here. Pig name: Mavice. You are a pig, and you have heard of a nuclear explosion that might hit soon, eat as much as you can, for good times before xxxx.

by nukeboy212

HTML

<canvas id="poop05" width="630" height="450"></canvas>
<canvas id="wee" width="630" height="450"></canvas>

<img src="http://pngimg.com/upload/green_leaves_PNG3678.png" id="ii">
<img src="http://vignette3.wikia.nocookie.net/adventuretimewithfinnandjake/images/0/06/Pig_trans.png/revision/latest?cb=20120812082359" id="one">

<h2 id="oi">
You are a delicate little fat pig you must live against horrible things (click to start)
</h2>

<img src="http://freepngimages.com/wp-content/uploads/2015/11/nuclear-explosion-transparent-background.png" id="iii">

CSS

canvas {
  background-color: pink;
}

img {
  display: none;
}

h2 {
  color: Red;
}

#wee {
  background-image: url("http://freepngimages.com/wp-content/uploads/2015/11/nuclear-explosion-transparent-background.png");
  background-repeat: no-repeat;
}

JavaScript

console.log("Hello! Most people won't bother looking at this text!");
$( document ).ready(function() {
$("#wee").hide();
var canvas = document.getElementById("poop05");
var ctx = canvas.getContext("2d");
var enemies = [];
var money = 0;
var time = 5;
var over = true;
function Enemy(I) {
  I = I || {};
  I.active = true;
  I.age = Math.floor(Math.random() * 128);
  I.color = "red";
  I.x = Math.random() * 1000;
  I.y = 0;
  I.xVelocity = 0;
  I.yVelocity = 2;
  I.width = 50;
  I.height = 50;

  I.inBounds = function() {
    return I.x >= 0 && I.x <= 1000 && I.y >= 0 && I.y <= 1000;
  };

  I.draw = function() {
    //ctx.fillStyle = this.color;
    //ctx.fillRect(this.x, this.y, this.width, this.height);
    ctx.drawImage(ii, this.x, this.y, this.width, this.height);

  };

  I.update = function() {
    I.x += I.xVelocity;
    I.y += I.yVelocity;
    I.age++;

    I.xVelocity = 3 * Math.sin(I.age * Math.PI / 64);

    I.active = I.active && I.inBounds();

  };
  return I;

};

var player = {
  color: "yellow",
  height: 80,
  width: 100,
  x: canvas.width / 2,
  y: canvas.height - 100,

  draw: function() {
    //ctx.fillStyle = this.color;
    //ctx.fillRect(this.x, this.y, this.width, this.height);
    ctx.drawImage(one, this.x, this.y, this.width, this.height);
  }
};

function draw() {

  ctx.clearRect(0, 0, canvas.width, canvas.height);
  player.draw();
  enemies.forEach(function(enemy) {
    enemy.draw();

  });
  drawscore();
  timer();
  //setInterval(timer,1000);
  //if (time <= 0) {
  //$('div').hide();
  //}
  //We want to explode everything aka destruction ayayayayayayayyyaayayayayyaayayyay fun times
};
if(over) {
function update() {
  enemies.forEach(function(enemy) {
    enemy.update();
  });
  enemies = enemies.filter(function(enemy) {
    return enemy.active;
  });
  if (Math.random() < 0.05) {
    enemies.push(Enemy());
  }
  handleCollisions();
}

setInterval(function() {
  draw();
  update();
}, 1000 / 30);


$(document).on("keydown",...