Pig Eatin Time II.0 SHOOTERS
Same game as before, but more awesome! The powerup has a dark secret behind it, when the potato is shot, he is enslaved to research a way to change the weather, so no bombs appear for 30 seconds.
by nukeboy212
HTML
<canvas id="poop05" width="630" height="450"></canvas>
<canvas id="wee" width="630" height="450"></canvas>
<img src="http://www.cheesemilkandpickle.com/uploads/7/0/1/5/7015407/4284711.gif" 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 eat awesome healthy things, but who says you have to obtain it by mouth?
Beware of BOB da Bomby!(click to start)
</h2>
<img src="http://freepngimages.com/wp-content/uploads/2015/11/nuclear-explosion-transparent-background.png" id="iii">
<button id="poop06">
RESET
</button>
<button id="scam">
CLICK THIS TO BE SCAMMED
</button>
<button id="add">
ADVERTISEMENT
</button>
<button id="butt">
Cant Click this!
</button>
<img src="http://www.medievalcollectibles.com/images/product/icon/OD61.png" id="GUN">
<img src="https://maxcdn.icons8.com/Android_L/PNG/512/Gaming/bomb-512.png" id="enemy2">
<img src="http://t10.deviantart.net/46BkkS7XZSctlxV2QkBYxU13ZE4=/300x200/filters:fixed_height(100,100):origin()/pre07/9211/th/pre/f/2016/023/6/7/derpy_potato_by_potter4me-d9p0tcj.png" id="potato">
CSS
canvas {
background-color: Grey;
}
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 = 240;
var over = true;
var bullets = [];
var bombs = [];
var powerUp = [];
$("#poop06").hide();
$("#scam").hide();
function Enemy(I) {
I = I || {};
I.active = true;
I.age = Math.floor(Math.random() * 100);
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;
};
function Bob(I) {
I = I || {};
I.active = true;
I.age = Math.floor(Math.random() * 100);
I.color = "red";
I.x = Math.random() * 1000;
I.y = 0;
I.xVelocity = 0;
I.yVelocity = 5;
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(enemy2, 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;
};
function Bullet(I) {
I.active = true;
...