@ -9,6 +9,14 @@
< / head >
< / head >
< body >
< body >
< audio loop = "loop" id = "theme2" preload = "auto" > < source src = "sound/theme2.wav" type = "audio/wav" > < / audio >
< audio loop = "loop" id = "theme4" preload = "auto" > < source src = "sound/theme4_scary.wav" type = "audio/wav" > < / audio >
< audio id = "click" > < source src = "sound/click.wav" type = "audio/wav" > < / audio >
< audio id = "comic" > < source src = "sound/speech.wav" type = "audio/wav" > < / audio >
< audio id = "yes" > < source src = "sound/yes.wav" type = "audio/wav" > < / audio >
< audio id = "no" > < source src = "sound/no.wav" type = "audio/wav" > < / audio >
< audio id = "shot" > < source src = "sound/shot.wav" type = "audio/wav" > < / audio >
< div id = "cover" > < / div >
< div id = "cover" > < / div >
< div id = "ground" class = "invert" > < / div >
< div id = "ground" class = "invert" > < / div >
< svg class = "invert" >
< svg class = "invert" >
@ -85,7 +93,7 @@
< / div >
< / div >
<!-- game bar -->
<!-- game bar -->
< div class = "game_bar " style = "display: none;" >
< div class = "game_bar invert " style = "display: none;" >
cat steaks: < span class = "cat_meat_bar" > < / span > / 4
cat steaks: < span class = "cat_meat_bar" > < / span > / 4
< / div >
< / div >
@ -93,10 +101,27 @@
< script src = "jquery.min.js" > < / script >
< script src = "jquery.min.js" > < / script >
< script >
< script >
var theme = document.querySelector("#theme2");
var scary = document.querySelector("#theme4");
var click = document.querySelector("#click");
var comic = document.querySelector("#comic");
var no = document.querySelector("#no");
var yes = document.querySelector("#yes");
var shot = document.querySelector("#shot");
$("body").hover( function() {
if (cat_meat < 4 ) {
theme.play();
theme.addEventListener('paused',function() {
theme.play();
},false);
}
})
// saves game step in the local storage
// saves game step in the local storage
window.onload = function() {
window.onload = function() {
theme.play();
comic.play();
window.localStorage.setItem("butchery","opened");
window.localStorage.setItem("butchery","opened");
console.log ("butcher store:",localStorage.butchery);
console.log ("butcher store:",localStorage.butchery);
$('.cat_meat_bar').html(cat_meat);
$('.cat_meat_bar').html(cat_meat);
@ -115,6 +140,7 @@
$(".bubble1").toggle();
$(".bubble1").toggle();
$(".message1").hide();
$(".message1").hide();
$(".message2, .game_bar").show();
$(".message2, .game_bar").show();
click.play();
setTimeout( function() {
setTimeout( function() {
$("#cover").css('z-index',-5);
$("#cover").css('z-index',-5);
$(".tables").css('cursor', 'pointer');
$(".tables").css('cursor', 'pointer');
@ -130,6 +156,7 @@
var weapon = $("#pill");
var weapon = $("#pill");
$("#table1").click (function(){
$("#table1").click (function(){
no.play();
$("#table1").addClass("touch_animation");
$("#table1").addClass("touch_animation");
setTimeout(function(){
setTimeout(function(){
$("#table1").removeClass("touch_animation");
$("#table1").removeClass("touch_animation");
@ -140,6 +167,7 @@
});
});
$("#table2").click (function(){
$("#table2").click (function(){
no.play();
$("#table2").addClass("touch_animation");
$("#table2").addClass("touch_animation");
setTimeout(function(){
setTimeout(function(){
$("#table2").removeClass("touch_animation");
$("#table2").removeClass("touch_animation");
@ -150,6 +178,7 @@
});
});
$("#table3").click (function(){
$("#table3").click (function(){
yes.play();
$("#table3").attr("src", "imgs/butchery/cat.gif");
$("#table3").attr("src", "imgs/butchery/cat.gif");
setTimeout(function(){
setTimeout(function(){
$("#table3").removeClass("touch_animation");
$("#table3").removeClass("touch_animation");
@ -161,6 +190,7 @@
});
});
$("#table4").click (function(){
$("#table4").click (function(){
no.play();
$("#table4").addClass("touch_animation");
$("#table4").addClass("touch_animation");
setTimeout(function(){
setTimeout(function(){
$("#table4").removeClass("touch_animation");
$("#table4").removeClass("touch_animation");
@ -171,6 +201,7 @@
});
});
$("#table5").click (function(){
$("#table5").click (function(){
no.play();
$("#table5").addClass("touch_animation");
$("#table5").addClass("touch_animation");
setTimeout(function(){
setTimeout(function(){
$("#table5").removeClass("touch_animation");
$("#table5").removeClass("touch_animation");
@ -181,6 +212,7 @@
});
});
$("#table6").click (function(){
$("#table6").click (function(){
no.play();
$("#table6").addClass("touch_animation");
$("#table6").addClass("touch_animation");
setTimeout(function(){
setTimeout(function(){
$("#table6").removeClass("touch_animation");
$("#table6").removeClass("touch_animation");
@ -191,6 +223,7 @@
});
});
$("#table7").click (function(){
$("#table7").click (function(){
yes.play();
$("#table7").attr("src", "imgs/butchery/cat.gif");
$("#table7").attr("src", "imgs/butchery/cat.gif");
setTimeout(function(){
setTimeout(function(){
$("#table7").removeClass("touch_animation");
$("#table7").removeClass("touch_animation");
@ -202,6 +235,7 @@
});
});
$("#table8").click (function(){
$("#table8").click (function(){
no.play();
$("#table8").addClass("touch_animation");
$("#table8").addClass("touch_animation");
setTimeout(function(){
setTimeout(function(){
$("#table8").removeClass("touch_animation");
$("#table8").removeClass("touch_animation");
@ -212,6 +246,7 @@
});
});
$("#table9").click (function(){
$("#table9").click (function(){
no.play();
$("#table9").addClass("touch_animation");
$("#table9").addClass("touch_animation");
setTimeout(function(){
setTimeout(function(){
$("#table9").removeClass("touch_animation");
$("#table9").removeClass("touch_animation");
@ -222,6 +257,7 @@
});
});
$("#table10").click (function(){
$("#table10").click (function(){
yes.play();
$("#table10").attr("src", "imgs/butchery/cat.gif");
$("#table10").attr("src", "imgs/butchery/cat.gif");
setTimeout(function(){
setTimeout(function(){
$("#table10").removeClass("touch_animation");
$("#table10").removeClass("touch_animation");
@ -233,6 +269,7 @@
});
});
$("#table11").click (function(){
$("#table11").click (function(){
yes.play();
$("#table11").attr("src", "imgs/butchery/cat.gif");
$("#table11").attr("src", "imgs/butchery/cat.gif");
setTimeout(function(){
setTimeout(function(){
$("#table11").removeClass("touch_animation");
$("#table11").removeClass("touch_animation");
@ -244,6 +281,7 @@
});
});
$("#table12").click (function(){
$("#table12").click (function(){
no.play();
$("#table12").addClass("touch_animation");
$("#table12").addClass("touch_animation");
setTimeout(function(){
setTimeout(function(){
$("#table12").removeClass("touch_animation");
$("#table12").removeClass("touch_animation");
@ -259,12 +297,16 @@
$("#cover").css("z-index",40);
$("#cover").css("z-index",40);
console.log ("you won!");
console.log ("you won!");
$(".message2").hide();
$(".message2").hide();
$(".game_bar").removeClass("invert");
$(".game_bar").addClass("game_bar_glow");
$(".game_bar").addClass("game_bar_glow");
setTimeout( function (){
setTimeout( function (){
$(".invert").addClass("invert_style");
$(".invert").addClass("invert_style");
theme.pause();
scary.play();
$("#butcher").show();
$("#butcher").show();
setTimeout( function (){
setTimeout( function (){
$("#knife").show();
$("#knife").show();
shot.play();
$("#knife").animate({left:'20%'}, {
$("#knife").animate({left:'20%'}, {
duration : 500
duration : 500
}).promise().done(function(){
}).promise().done(function(){
@ -272,10 +314,14 @@
$("#pat").attr("src", "imgs/butchery/parrot_r.gif");
$("#pat").attr("src", "imgs/butchery/parrot_r.gif");
$("#pat").height(85);
$("#pat").height(85);
$(".message_won").show();
$(".message_won").show();
click.play();
setTimeout( function (){
setTimeout( function (){
$(".bubble2").show();
$(".bubble2").show();
comic.play();
$("#butcher").hide();
$("#butcher").hide();
$(".invert").removeClass("invert_style");
$(".invert").removeClass("invert_style");
scary.pause();
theme.play();
}, 5000)
}, 5000)
});
});
}, 300);
}, 300);
@ -283,22 +329,27 @@
};
};
$(".bubble2").click(function(){
$(".bubble2").click(function(){
comic.play();
$(".bubble2").hide();
$(".bubble2").hide();
$(".bubble3").show();
$(".bubble3").show();
setTimeout( function (){
setTimeout( function (){
$("#pat").attr("src", "imgs/butchery/parrot_d.png");
$("#pat").attr("src", "imgs/butchery/parrot_d.png");
$(".message_won").hide();
$(".message_won").hide();
$(".message_final").show();
$(".message_final").show();
click.play();
}, 2000)
}, 2000)
});
});
$(".bubble3").click(function(){
$(".bubble3").click(function(){
click.play();
$(".bubble3").hide();
$(".bubble3").hide();
});
});
if (error == 3) {
if (error == 3) {
setTimeout (function() {
setTimeout (function() {
theme.pause();
scary.play();
$("#cover").css("z-index",40);
$("#cover").css("z-index",40);
console.log ("you lost!");
console.log ("you lost!");
$(".message_won, .message2").hide();
$(".message_won, .message2").hide();
@ -306,17 +357,21 @@
$("#butcher, #thunder").show();
$("#butcher, #thunder").show();
setTimeout( function (){
setTimeout( function (){
$(".message_lost").show();
$(".message_lost").show();
click.play();
}, 1000);
}, 1000);
}, 600);
}, 600);
};
};
};
};
$("#try_again").click( function (){
$("#try_again").click( function (){
theme.play();
scary.pause();
cat_meat=0;
cat_meat=0;
error=0;
error=0;
$('.cat_meat_bar').html(cat_meat);
$('.cat_meat_bar').html(cat_meat);
$(".message_lost, #butcher, #thunder").hide();
$(".message_lost, #butcher, #thunder").hide();
$(".message2").show();
$(".message2").show();
click.play();
$("#cover").css("z-index",-5);
$("#cover").css("z-index",-5);
$(".invert").removeClass("invert_style");
$(".invert").removeClass("invert_style");
$(".tables").attr("src", "imgs/butchery/meat1.gif");
$(".tables").attr("src", "imgs/butchery/meat1.gif");