Fixed Things
- 'use strict'; donse't work for some reason. - game.min is pointless here. - Cleaned the HTML
This commit is contained in:
parent
390fc99f58
commit
e0ef78ba4c
3 changed files with 23 additions and 17 deletions
|
@ -1,4 +1,3 @@
|
|||
'use strict';
|
||||
//General
|
||||
var MOBILE_WIDH = 930;
|
||||
var WINDOW_W = $(window).width();
|
||||
|
|
1
src/game.min.js
vendored
1
src/game.min.js
vendored
|
@ -1 +0,0 @@
|
|||
function newGame(a){for(word=a[Math.floor(Math.random()*a.length)],incercari=6,charArray1=[],charArray2=[],missArray=[],i=0;i<word.length;i++)charArray1[i]="*";for(i=0;i<word.length;i++)charArray2[i]=word.charAt(i);$(".word").html(charArray1),$("#human").attr("src","./img/"+incercari+".png"),$("#incercari").html(incercari),$(".litera_msg2").html()}function gameWon(){return MOBILE_WIDH>=WINDOW_W?(ion.sound.play("ta_da"),alert("Felicita e tenersi per mano"),void window.location.reload()):(WINDOW_W>MOBILE_WIDH&&$("#gamewon").fadeIn("slow"),$(document).off(),ion.sound.play("ta_da"),$("#gamewon img").click(function(){window.location.reload()}),void $(document).on("keypress",function(a){var r=a.keyCode||a.which;13==r&&window.location.reload()}))}function gameOver(){return MOBILE_WIDH>=WINDOW_W?(ion.sound.play("sad_trombone"),alert("Ai pierdut! CUVANT: "+word),void window.location.reload()):($("#incercari_msg").html("Game Over!"),$("#lose_word").html(word),WINDOW_W>MOBILE_WIDH&&$("#gameover").fadeIn("slow"),$(document).off(),ion.sound.play("sad_trombone"),$("#gameover img").click(function(){window.location.reload()}),void $(document).on("keypress",function(a){var r=a.keyCode||a.which;13==r&&window.location.reload()}))}function check(a){return word.indexOf(a)>-1}function updateLetters(a){var r=missArray.length;$.inArray(a,missArray)>-1||(missArray[r]=a),$(".litere").html(missArray+" ")}function updateArray(a){for(a=a.toLowerCase(),i=0;i<charArray1.length;i++)charArray2[i]==a&&(charArray1[i]=a)}function arraysEqual(a,r){if(a===r)return!0;if(null==a||null==r)return!1;if(a.length!=r.length)return!1;for(var e=0;e<a.length;++e)if(a[e]!==r[e])return!1;return!0}var MOBILE_WIDH=930,WINDOW_W=$(window).width();ion.sound({sounds:[{name:"button_tiny",volume:.8,preload:!0},{name:"ta_da",volume:.8,preload:!0},{name:"sad_trombone",volume:.8,preload:!0}],volume:.5,path:"./sound/sounds/",preload:!0});var word,incercari,missArray,charArray1,charArray2,missArray;$(document).ready(function(){$(".footer-content").append('<p><span>Spanzuratoarea</span> <em>created by</em><span>@<a href="http://www.twitter.com/niutenisu">Niutenisu</a></span><p>');var listaCuvinte=localStorage.getItem("listaCuvinte");null!=listaCuvinte?($("select[name=lista_cuvinte]").val(listaCuvinte),newGame(eval(listaCuvinte))):newGame(animale_eu),$("select[name=lista_cuvinte]").on("change",function(){localStorage.setItem("listaCuvinte",$(this).val())}).next().click(function(){newGame(eval($(this).prev().val()))}),$("#game").fadeIn("slow")}),$(document).on("keypress",function(a){var r=a.keyCode||a.which,e=String.fromCharCode(r).toLowerCase();ion.sound.play("button_tiny"),$(".litera_msg").fadeIn("slow"),$(".litera").html(e),check(e)?($(".litera_msg2").html("aceasta litera se afla in cuvant."),updateArray(e),$(".word").html(charArray1)):($(".litera_msg2").html("aceasta litera nu se afla in cuvant."),incercari--,incercari>-1&&($("#human").attr("src","./img/"+incercari+".png"),$("#incercari").html(incercari),updateLetters(e),0==incercari&&gameOver())),arraysEqual(charArray1,charArray2)&&gameWon()});
|
|
@ -30,8 +30,12 @@
|
|||
|
||||
<h4 class="litera_msg" style="display: none;">Ai apasat pe "
|
||||
|
||||
|
||||
|
||||
<span class="litera" style="color: red;"></span>
|
||||
|
||||
|
||||
|
||||
<span class="litera_msg2"></span>"</h4>
|
||||
|
||||
<h4 class="litere" style="color: red;"></h4>
|
||||
|
@ -60,8 +64,12 @@
|
|||
<br>
|
||||
<h4 class="litera_msg" style="display: none;">Ai apasat pe "
|
||||
|
||||
|
||||
|
||||
<span class="litera red" style="color: red;"></span>
|
||||
|
||||
|
||||
|
||||
"<span class="litera_msg2"></span>"</h4>
|
||||
<br>
|
||||
<br>
|
||||
|
|
Loading…
Reference in a new issue