|
|
|
@ -18,6 +18,10 @@
|
|
|
|
|
<div id="groundline"></div>
|
|
|
|
|
|
|
|
|
|
<div id="player_img"></div>
|
|
|
|
|
|
|
|
|
|
<div id="ground">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -33,6 +37,9 @@
|
|
|
|
|
<img id="flower5" src="imgs/park/flower1.gif" height="5%">
|
|
|
|
|
<img id="grass1" src="imgs/park/grass1.gif" height="75vw">
|
|
|
|
|
<img id="grass2" src="imgs/park/grass1.gif" height="75vw">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -46,25 +53,34 @@ move
|
|
|
|
|
<script src="jquery.min.js"></script>
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
//move
|
|
|
|
|
// player moves
|
|
|
|
|
|
|
|
|
|
var $div = $('#player_img');
|
|
|
|
|
|
|
|
|
|
$(document).keydown(function(e) {
|
|
|
|
|
switch (e.which) {
|
|
|
|
|
case 37:
|
|
|
|
|
$div.css('left', $div.offset().left - 20);
|
|
|
|
|
$div.css('left', $div.offset().left - 20);
|
|
|
|
|
break;
|
|
|
|
|
case 38:
|
|
|
|
|
$div.css('top', $div.offset().top - 20);
|
|
|
|
|
$div.css('top', $div.offset().top - 20);
|
|
|
|
|
break;
|
|
|
|
|
case 39:
|
|
|
|
|
$div.css('left', $div.offset().left + 20);
|
|
|
|
|
$div.css('left', $div.offset().left + 20);
|
|
|
|
|
break;
|
|
|
|
|
case 40:
|
|
|
|
|
$div.css('top', $div.offset().top + 20);
|
|
|
|
|
$div.css('top', $div.offset().top + 20);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
//get player avatar from local storage
|
|
|
|
|
|
|
|
|
|
// saves game step in the local storage
|
|
|
|
|
window.onload = function() {
|
|
|
|
|
window.localStorage.setItem("looking_for_N","opened")
|
|
|
|
|
console.log ("looking for N:",localStorage.looking_for_N)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get player avatar from local storage
|
|
|
|
|
console.log (localStorage.myavatar)
|
|
|
|
|
var img = document.createElement("img");
|
|
|
|
|
img.src = localStorage.myavatar;
|
|
|
|
|