fix
This commit is contained in:
parent
f57dcad25f
commit
6836da99a6
52
js/snake.js
52
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();
|
||||
|
11
snake.css
11
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;
|
||||
}
|
||||
|
||||
|
14
snake.html
14
snake.html
@ -11,7 +11,7 @@
|
||||
<button id="add_question">Dodaj pytanie!</button>
|
||||
<form id='popup_question'>
|
||||
<input type="text" name="question" placeholder="Podaj pytanie"><br>
|
||||
<input type="text" name="answer" placeholder="Podaj odpowiedz 1 (poprawną)"><br>
|
||||
<input type="text" name="answer" placeholder="Podaj odpowiedz 1 (poprawna)"><br>
|
||||
<input type="text" name="answer" placeholder="Podaj odpowiedz 2"><br>
|
||||
<input type="text" name="answer" placeholder="Podaj odpowiedz 3"><br>
|
||||
<input type="text" name="answer" placeholder="Podaj odpowiedz 4"><br>
|
||||
@ -19,7 +19,7 @@
|
||||
<br>
|
||||
<a id="clear_local_storage">Wyczyść bazę pytań</a>
|
||||
</form>
|
||||
|
||||
|
||||
<div id="popup">
|
||||
<div id="form-popup">
|
||||
<h2>Odpowiedz na pytanie!</h2>
|
||||
@ -36,18 +36,18 @@
|
||||
Twoj wynik to: <span id="final"></span><br>
|
||||
</span>
|
||||
<br>
|
||||
<button id="restart" href="#">Wyśnij, aby kontynuować</button>
|
||||
<button id="try_again" href="#">Spróbuj jeszcze raz</button>
|
||||
</div>
|
||||
<button id="restart" href="#">Wysnij, aby kontynuowac</button>
|
||||
<button id="try_again" href="#">Sprobuj jeszcze raz</button>
|
||||
</div>
|
||||
</div>
|
||||
<canvas id="myCanvas" width="600" height="450">
|
||||
Your browser does not support the canvas feature
|
||||
</canvas>
|
||||
<div id="score">
|
||||
<div>Punkty: <span id="session">0</span></div>
|
||||
<div>Życia: <span id="lifes">4</span></div>
|
||||
<div>Zycia: <span id="lifes">4</span></div>
|
||||
</div>
|
||||
<button id="restart_game">Resetuj grę</button>
|
||||
<button id="restart_game">Resetuj gre</button>
|
||||
</div>
|
||||
<!-- Json
|
||||
<script src="js/pytania.json" type="text/javascript"></script> -->
|
||||
|
Loading…
Reference in New Issue
Block a user