@ -9,6 +9,14 @@
< / head >
< 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 = "ground" class = "invert" > < / div >
< svg class = "invert" >
@ -85,22 +93,39 @@
< / div >
<!-- 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
< / div >
< 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
window.onload = function() {
window.localStorage.setItem("butchery","opened");
console.log ("butcher store:",localStorage.butchery);
$('.cat_meat_bar').html(cat_meat);
}
theme.play();
comic.play();
window.localStorage.setItem("butchery","opened");
console.log ("butcher store:",localStorage.butchery);
$('.cat_meat_bar').html(cat_meat);
}
//get player avatar from local storage
console.log (localStorage.myavatar)
@ -115,6 +140,7 @@
$(".bubble1").toggle();
$(".message1").hide();
$(".message2, .game_bar").show();
click.play();
setTimeout( function() {
$("#cover").css('z-index',-5);
$(".tables").css('cursor', 'pointer');
@ -130,6 +156,7 @@
var weapon = $("#pill");
$("#table1").click (function(){
no.play();
$("#table1").addClass("touch_animation");
setTimeout(function(){
$("#table1").removeClass("touch_animation");
@ -140,6 +167,7 @@
});
$("#table2").click (function(){
no.play();
$("#table2").addClass("touch_animation");
setTimeout(function(){
$("#table2").removeClass("touch_animation");
@ -150,6 +178,7 @@
});
$("#table3").click (function(){
yes.play();
$("#table3").attr("src", "imgs/butchery/cat.gif");
setTimeout(function(){
$("#table3").removeClass("touch_animation");
@ -161,6 +190,7 @@
});
$("#table4").click (function(){
no.play();
$("#table4").addClass("touch_animation");
setTimeout(function(){
$("#table4").removeClass("touch_animation");
@ -171,6 +201,7 @@
});
$("#table5").click (function(){
no.play();
$("#table5").addClass("touch_animation");
setTimeout(function(){
$("#table5").removeClass("touch_animation");
@ -181,6 +212,7 @@
});
$("#table6").click (function(){
no.play();
$("#table6").addClass("touch_animation");
setTimeout(function(){
$("#table6").removeClass("touch_animation");
@ -191,6 +223,7 @@
});
$("#table7").click (function(){
yes.play();
$("#table7").attr("src", "imgs/butchery/cat.gif");
setTimeout(function(){
$("#table7").removeClass("touch_animation");
@ -202,6 +235,7 @@
});
$("#table8").click (function(){
no.play();
$("#table8").addClass("touch_animation");
setTimeout(function(){
$("#table8").removeClass("touch_animation");
@ -212,6 +246,7 @@
});
$("#table9").click (function(){
no.play();
$("#table9").addClass("touch_animation");
setTimeout(function(){
$("#table9").removeClass("touch_animation");
@ -222,6 +257,7 @@
});
$("#table10").click (function(){
yes.play();
$("#table10").attr("src", "imgs/butchery/cat.gif");
setTimeout(function(){
$("#table10").removeClass("touch_animation");
@ -233,6 +269,7 @@
});
$("#table11").click (function(){
yes.play();
$("#table11").attr("src", "imgs/butchery/cat.gif");
setTimeout(function(){
$("#table11").removeClass("touch_animation");
@ -244,6 +281,7 @@
});
$("#table12").click (function(){
no.play();
$("#table12").addClass("touch_animation");
setTimeout(function(){
$("#table12").removeClass("touch_animation");
@ -259,12 +297,16 @@
$("#cover").css("z-index",40);
console.log ("you won!");
$(".message2").hide();
$(".game_bar").removeClass("invert");
$(".game_bar").addClass("game_bar_glow");
setTimeout( function (){
$(".invert").addClass("invert_style");
theme.pause();
scary.play();
$("#butcher").show();
setTimeout( function (){
$("#knife").show();
shot.play();
$("#knife").animate({left:'20%'}, {
duration : 500
}).promise().done(function(){
@ -272,10 +314,14 @@
$("#pat").attr("src", "imgs/butchery/parrot_r.gif");
$("#pat").height(85);
$(".message_won").show();
click.play();
setTimeout( function (){
$(".bubble2").show();
comic.play();
$("#butcher").hide();
$(".invert").removeClass("invert_style");
scary.pause();
theme.play();
}, 5000)
});
}, 300);
@ -283,22 +329,27 @@
};
$(".bubble2").click(function(){
comic.play();
$(".bubble2").hide();
$(".bubble3").show();
setTimeout( function (){
$("#pat").attr("src", "imgs/butchery/parrot_d.png");
$(".message_won").hide();
$(".message_final").show();
click.play();
}, 2000)
});
$(".bubble3").click(function(){
click.play();
$(".bubble3").hide();
});
if (error == 3) {
setTimeout (function() {
theme.pause();
scary.play();
$("#cover").css("z-index",40);
console.log ("you lost!");
$(".message_won, .message2").hide();
@ -306,17 +357,21 @@
$("#butcher, #thunder").show();
setTimeout( function (){
$(".message_lost").show();
click.play();
}, 1000);
}, 600);
};
};
$("#try_again").click( function (){
theme.play();
scary.pause();
cat_meat=0;
error=0;
$('.cat_meat_bar').html(cat_meat);
$(".message_lost, #butcher, #thunder").hide();
$(".message2").show();
click.play();
$("#cover").css("z-index",-5);
$(".invert").removeClass("invert_style");
$(".tables").attr("src", "imgs/butchery/meat1.gif");