diff --git a/tree/.ipynb_checkpoints/canteen-checkpoint.html b/tree/.ipynb_checkpoints/canteen-checkpoint.html new file mode 100644 index 0000000..d822879 --- /dev/null +++ b/tree/.ipynb_checkpoints/canteen-checkpoint.html @@ -0,0 +1,262 @@ + + + + + + canteen + + + + + +
+ + + + + + + + + +
+ + + + + + + + + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + + + + + + + + + + + +
+
+ You are now in the school canteen. The staff is there as well: your plan might be getting complicated.
+ Click on the corn cobs on the table to take them with you. +
+ + +
+ + +
+ fluoride: / 5 +
+ + + + + + + + + \ No newline at end of file diff --git a/tree/canteen.html b/tree/canteen.html index 8f12089..d822879 100644 --- a/tree/canteen.html +++ b/tree/canteen.html @@ -118,26 +118,49 @@ var fluoride = 5; var weapon = $("#pill"); $(".figure1").click (function(){ - --fluoride; - console.log(fluoride); - weapon.hide(); - $('.cobs_collected').html(fluoride); - duo.animate({top:'18%'}, 500, function() { - weapon.show(); - weapon.animate({ left: "30%" }, 150,function(){ - $("#satan1").attr("src", "imgs/canteen/fire_once.gif"); - weapon.hide(); - weapon.animate({ left: "11%" }, function(){ - setTimeout(stop_game(), 6000); - }); - }); - }); - hit_ned(); + --fluoride; + console.log("fluoride:", fluoride); + weapon.hide(); + $('.cobs_collected').html(fluoride); + /* duo.animate({top:'18%'}, { + duration : 500, + done : function() { + weapon.show(); + console.log("weapon show"); + weapon.animate({ left: "30%" }, { + duration: 2000, + done : function(){ + $("#satan1").attr("src", "imgs/canteen/fire_once.gif"); + weapon.hide(); + console.log("weapon hide"); + weapon.css({ left: "11%" }); + setTimeout(stop_game, 3000); + } + }); + } + }); */ + + duo.animate({top:'18%'}, { + duration : 500 + }).promise().done(function () { + weapon.show(); + console.log("weapon show"); + weapon.animate({ left: "30%" }, { + duration: 2000 + }).promise().done(function(){ + $("#satan1").attr("src", "imgs/canteen/fire_once.gif"); + weapon.hide(); + console.log("weapon hide"); + weapon.css({ left: "11%" }); + check_end_game(); + }); + }); + hit_ned(); }); $(".figure2").click (function(){ --fluoride; - console.log(fluoride); + console.log("fluoride:", fluoride); weapon.hide(); $('.cobs_collected').html(fluoride); duo.animate({top:'12%' }, 500, function() { @@ -146,7 +169,7 @@ var fluoride = 5; $("#satan2").attr("src", "imgs/canteen/fire_once.gif"); weapon.hide(); weapon.animate({ left: "11%" }, function(){ - setTimeout(stop_game(), 6000); + setTimeout(stop_game, 3000); }); }); }); @@ -155,7 +178,7 @@ var fluoride = 5; $(".figure3").click (function(){ --fluoride; - console.log(fluoride); + console.log("fluoride:", fluoride); $('.cobs_collected').html(fluoride); duo.animate({top:'22%'}, 500, function() { weapon.show(); @@ -163,7 +186,7 @@ var fluoride = 5; $("#satan3").attr("src", "imgs/canteen/fire_once.gif"); weapon.hide(); weapon.animate({ left: "11%" }, function(){ - setTimeout(stop_game(), 6000); + setTimeout(stop_game, 3000); }); }); }); @@ -172,7 +195,7 @@ var fluoride = 5; $(".figure4").click (function(){ --fluoride; - console.log(fluoride); + console.log("fluoride:", fluoride); $('.cobs_collected').html(fluoride); duo.animate({top:'50%'}, 500, function() { weapon.show(); @@ -180,7 +203,7 @@ var fluoride = 5; $("#satan4").attr("src", "imgs/canteen/fire_once.gif"); weapon.hide(); weapon.animate({ left: "11%" }, function(){ - setTimeout(stop_game(), 6000); + setTimeout(stop_game, 3000); }); }); }); @@ -189,15 +212,15 @@ var fluoride = 5; $(".figure5").click (function(){ --fluoride; - console.log(fluoride); + console.log("fluoride:", fluoride); $('.cobs_collected').html(fluoride); duo.animate({top:'40%'}, 500, function() { weapon.show(); weapon.animate({ left: "80%" }, 150,function(){ $("#satan5").attr("src", "imgs/canteen/fire_once.gif"); weapon.hide(); - weapon.animate({ left: "11%" }, {step: function(){ - setTimeout(stop_game(), 6000); + weapon.animate({ left: "11%" }, {function(){ + setTimeout(stop_game, 3000); } }); }); @@ -215,14 +238,18 @@ var fluoride = 5; var figures_all = $(".figure1, .figure2, .figure3, .figure4, .figure5"); - function stop_game() { + function check_end_game() { + console.log("check end game"); if (fluoride == 0) { figures_all.detach(); - $("#column").hide(); - console.log("hei"); - setTimeout($(".invert").removeClass("invert_style"), 3000); - $(".message2").hide(); - $(".message3").show(); + console.log("game over!"); + setTimeout( function (){ + $("#column").hide(); + setTimeout($(".invert").removeClass("invert_style"), 3000); + $(".message2").hide(); + $(".message3").show(); + }, 3000); + //setTimeout(avatar.animate ({top:"50%"}), 2000); }; };