From 6836da99a673eabe62af290161e7b6fedd34c788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kawczy=C5=84ski?= Date: Wed, 24 Jan 2018 11:28:31 +0100 Subject: [PATCH] fix --- js/snake.js | 52 ++++++++++++++++++++++++++-------------------------- snake.css | 11 +++++------ snake.html | 14 +++++++------- 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/js/snake.js b/js/snake.js index 5531235..2be54e9 100644 --- a/js/snake.js +++ b/js/snake.js @@ -2,14 +2,14 @@ $(document).ready(function () { - - - - - - - + + + + + + + var canvas = $("#myCanvas")[0]; var ctx = canvas.getContext("2d"); var w = $("#myCanvas").width(); @@ -32,7 +32,7 @@ $(document).ready(function () { setLifeCouter(3); } } - + function tryAgain(){ window.location.reload(); if(localStorage.getItem("life_couter") === null ){ @@ -94,18 +94,18 @@ $(document).ready(function () { if(localStorage.getItem("new_question") === null){ localStorage.setItem('id_question', 0); localStorage.setItem("new_question",form); - alert('Dodano pytanie. Wciśnij Ok. Dodaj następne pytanie lub wciśnij F5 i graj'); + alert('Dodano pytanie. Wcisnij Ok. Dodaj nastepne pytanie lub wcisnij F5 i graj'); } else{ id_question = localStorage.getItem('id_question'); id_question++ ; localStorage.setItem(`new_question-${id_question}`,form); localStorage.setItem('id_question', id_question); - alert('Dodano pytanie. Wciśnij Ok. Dodaj następne pytanie lub wciśnij F5 i graj'); + alert('Dodano pytanie. Wcisnij Ok. Dodaj nastepne pytanie lub wcisnij F5 i graj'); } $(this).closest('form').find("input[type=text]").val(""); }); - + // $('#accept').click(function(){ // var goodAnswer = $("input[class='yes']"); // console.log(goodAnswer); @@ -115,7 +115,7 @@ $(document).ready(function () { // else{ // console.log('zla odpowiedz'); // } - + // }); $('#clear_local_storage').click(function(){ localStorage.removeItem(`new_question`); @@ -128,7 +128,7 @@ $(document).ready(function () { $('#restart_game').click(function(){ setLifeCouter(3); setSessionScore(0); - alert('Zresetowałeś swoje życia, wciśnij Ok, a następnie F5 żeby zacząć od nowa'); + alert('Zresetowales swoje zycia, wcisnij Ok, a nastepnie F5 zeby zaczac od nowa'); }) $('#add_question').click(function(){ var isHidden = localStorage.getItem('isHidden'); @@ -149,11 +149,11 @@ $(document).ready(function () { $('#try_again').click(function(){ tryAgain(); }) - + $('#session').text(getSessionScore()); $('#lifes').text(localStorage.getItem('life_couter')); if(localStorage.getItem('life_couter') == 0){ - alert(`Koniec gry! Twoj wynik to: ${localStorage.getItem('session_score')}. Jeżeli chcesz zagrać jeszcze raz wciśnij Ok, następnie Resetuj grę, poźniej F5`); + alert(`Koniec gry! Twoj wynik to: ${localStorage.getItem('session_score')}. Jezeli chcesz zagrac jeszcze raz wcisnij Ok, nastepnie Resetuj gre, pozniej F5`); } function update() { if (d == "RIGHT") @@ -173,7 +173,7 @@ $(document).ready(function () { } function randomYes() { - + var newClass = "yes"; var randomKey = parseInt(Math.floor(Math.random() * 4)); $("div").each(function () { @@ -202,7 +202,7 @@ $(document).ready(function () { } function showQuestionTask() { - + function pickRandomQuestion(){ var questionKey = 'new_question'; var id = localStorage.getItem('id_question'); @@ -224,17 +224,17 @@ $(document).ready(function () { var current = $('#current').text(); $('#final').text(current); if(randomQuestion === null){ - alert('Pytania nie zostaly dodane. Wciśnij Ok, następnie F5 i dodaj pytania'); + alert('Pytania nie zostaly dodane. Wcisnij Ok, nastepnie F5 i dodaj pytania'); } randomYes(); addTextToAnserws(randomQuestion); $('#popup').fadeIn(); - + // $(".popup-item").each(function(index){ // var newId = "yes"; - - + + // }); $('.yes').click(function () { if ($('.yes').is(':checked')) { @@ -252,15 +252,15 @@ $(document).ready(function () { setSessionScore(sessionScore); setQuestionCouter(questionCouter); $('#restart').fadeIn('slow'); - + } }); $('.no').click(function(){ if($('.no').is(':checked')){ $('#incorrect').fadeIn('slow'); $('.yes').attr('disabled','disabled').delay(1000);; - $('.no').prop('checked', true); - $('#try_again').fadeIn('slow'); + $('.no').attr('disabled', 'disabled'); + $('#try_again').fadeIn('slow'); } }) } @@ -273,7 +273,7 @@ $(document).ready(function () { } } - + function placeFood() { food = { x: Math.round(Math.random() * (w - cw) / cw), @@ -327,7 +327,7 @@ $(document).ready(function () { gameloop = start(); - + placeFood(); paint_cell(food.x, food.y, "grey"); placeSnake(); diff --git a/snake.css b/snake.css index 46fcec8..f7376bd 100644 --- a/snake.css +++ b/snake.css @@ -20,7 +20,7 @@ body { #add_question { position : absolute; top: 100px; - left: 1750px; + left: 1500px; } #popup { background-color: rgba(0,0,0,.25); @@ -32,7 +32,7 @@ body { position: fixed; top: 0; width: 100%; - + } input[type="text"] { @@ -62,13 +62,13 @@ input[type="text"] { #form-popup { - + position: absolute; justify-content: center; align-items: center; display: flex; top: 20%; - left: 40%; + left: 32.5%; background-color: rgb(255,255,255); border-radius: 10px; padding: 0; @@ -80,7 +80,7 @@ input[type="text"] { #popup_question { position : absolute; top: 150px; - left: 1750px; + left: 1500px; font-size: 20px; text-align: center; color: rgb(100, 219, 223); @@ -232,4 +232,3 @@ a { position:relative; top:1px; } - diff --git a/snake.html b/snake.html index 870ddaa..963ac2f 100644 --- a/snake.html +++ b/snake.html @@ -11,7 +11,7 @@ - + Your browser does not support the canvas feature
Punkty: 0
-
Życia: 4
+
Zycia: 4
- +