|
|
|
@ -14,10 +14,8 @@
|
|
|
|
|
|
|
|
|
|
<div id="groundline" class="invert"></div>
|
|
|
|
|
|
|
|
|
|
<div id="ground">
|
|
|
|
|
<div class="army">
|
|
|
|
|
<div id="player_img" ></div>
|
|
|
|
|
|
|
|
|
|
<img id="fighter1" src="imgs/spring_river/fighter1.gif" height="120px">
|
|
|
|
|
<img id="fighter2" src="imgs/spring_river/fighter2.gif" height="120px">
|
|
|
|
|
<img id="fighter3" src="imgs/spring_river/fighter3.gif" height="120px">
|
|
|
|
@ -26,12 +24,9 @@
|
|
|
|
|
<img id="fighter6" src="imgs/spring_river/fighter6.gif" height="160px">
|
|
|
|
|
<img id="fighter7" src="imgs/spring_river/fighter7.gif" height="120px">
|
|
|
|
|
<img id="fighter8" src="imgs/spring_river/fighter8.gif" height="120px">
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div id="ground">
|
|
|
|
|
|
|
|
|
|
<img id="tree1" src="imgs/spring_river/tree4.gif" height="160px">
|
|
|
|
|
<img id="tree2" src="imgs/spring_river/tree4.gif" height="160px">
|
|
|
|
@ -39,20 +34,11 @@
|
|
|
|
|
<img id="tree4" src="imgs/spring_river/tree4.gif" height="160px">
|
|
|
|
|
<img id="tree5" src="imgs/spring_river/tree4.gif" height="160px">
|
|
|
|
|
<img id="tree6" src="imgs/spring_river/tree4.gif" height="160px">
|
|
|
|
|
<!-- flowers
|
|
|
|
|
<img id="flower1" src="imgs/spring_river/flower1.gif" height="30px">
|
|
|
|
|
<img id="flower2" src="imgs/spring_river/flower3.gif" height="40px">
|
|
|
|
|
<img id="flower3" src="imgs/spring_river/flower3.1.gif" height="40px">
|
|
|
|
|
<img id="flower4" src="imgs/spring_river/flower1.1.gif" height="30px">
|
|
|
|
|
<img id="flower5" src="imgs/spring_river/flower1.gif" height="30px">
|
|
|
|
|
<img id="flower6" src="imgs/spring_river/flower1.1.gif" height="30px">
|
|
|
|
|
<img id="flower7" src="imgs/spring_river/flower3.1.gif" height="40px">
|
|
|
|
|
<img id="flower8" src="imgs/spring_river/flower3.1.gif" height="40px">
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="text_container invert" >
|
|
|
|
|
|
|
|
|
|
<div class="message1">
|
|
|
|
|
You and your army arrived at the Spring River Natural Park.<br>
|
|
|
|
|
<span class="instructions"><span class="instructions_arrow">→</span> Move with the right arrow to find the children!</span>
|
|
|
|
@ -67,12 +53,24 @@
|
|
|
|
|
<script src="jquery.min.js"></script>
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
// player moves
|
|
|
|
|
// saves game step in the local storage
|
|
|
|
|
window.onload = function() {
|
|
|
|
|
window.localStorage.setItem("spring_river","opened");
|
|
|
|
|
console.log ("spring river:",localStorage.spring_river);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get player avatar from local storage
|
|
|
|
|
console.log (localStorage.myavatar)
|
|
|
|
|
var img = document.createElement("img");
|
|
|
|
|
img.src = localStorage.myavatar;
|
|
|
|
|
var player_img = document.querySelector("#player_img");
|
|
|
|
|
player_img.appendChild(img);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//adjust camera scroll
|
|
|
|
|
var $div = $('.army');
|
|
|
|
|
var screenLeftMin = 200;
|
|
|
|
|
var screenLeftMax = 870;
|
|
|
|
|
var screenLeftMin = 100;
|
|
|
|
|
var screenLeftMax = 780;
|
|
|
|
|
|
|
|
|
|
function adjustScroll() {
|
|
|
|
|
var playerLeft = parseInt($div.css("left"));
|
|
|
|
@ -91,25 +89,19 @@
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//move the character
|
|
|
|
|
|
|
|
|
|
$(document).keydown(function(e) {
|
|
|
|
|
var offset = $div.position();
|
|
|
|
|
console.log("offset:", offset);
|
|
|
|
|
|
|
|
|
|
/* change z-index
|
|
|
|
|
var parent_height = $("#ground").height();
|
|
|
|
|
var top_val_px = $div.css('top');
|
|
|
|
|
var top_val_only = parseInt(top_val_px);
|
|
|
|
|
var top_Percentage = (top_val_only/parent_height) * 100;
|
|
|
|
|
console.log ("top %", top_Percentage);
|
|
|
|
|
|
|
|
|
|
// change z-index
|
|
|
|
|
var parent_width = $("#ground").width();
|
|
|
|
|
var left_val_px = $div.css('left');
|
|
|
|
|
var left_val_only = parseInt(left_val_px);
|
|
|
|
|
var left_Percentage = (left_val_only/parent_width) * 100;
|
|
|
|
|
console.log ("left %", left_Percentage);
|
|
|
|
|
/*
|
|
|
|
|
if (top_Percentage > 65) {
|
|
|
|
|
$div.css ("zIndex", 5)
|
|
|
|
|
}
|
|
|
|
@ -121,25 +113,17 @@ $(document).keydown(function(e) {
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (e.which) {
|
|
|
|
|
case 37:
|
|
|
|
|
offset.left -= 20;
|
|
|
|
|
console.log("left");
|
|
|
|
|
break;
|
|
|
|
|
case 38:
|
|
|
|
|
offset.top -= 20;
|
|
|
|
|
console.log("top");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 39:
|
|
|
|
|
offset.left += 20;
|
|
|
|
|
console.log("right");
|
|
|
|
|
break;
|
|
|
|
|
case 40:
|
|
|
|
|
offset.top += 20;
|
|
|
|
|
console.log("down");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//check the offset and prevent the character to exceed the screen dimension
|
|
|
|
|
if (offset.left < 80) {
|
|
|
|
@ -150,14 +134,6 @@ $(document).keydown(function(e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (offset.top < 50) {
|
|
|
|
|
offset.top = 50;
|
|
|
|
|
}
|
|
|
|
|
if (offset.top > $("#ground").height() - 50) {
|
|
|
|
|
offset.top = $("#ground").height() - 50;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$div.css("left", offset.left);
|
|
|
|
|
$div.css("top", offset.top);
|
|
|
|
|
e.preventDefault();
|
|
|
|
@ -166,23 +142,6 @@ $(document).keydown(function(e) {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// saves game step in the local storage
|
|
|
|
|
window.onload = function() {
|
|
|
|
|
window.localStorage.setItem("spring_river","opened")
|
|
|
|
|
console.log ("Spring River:",localStorage.spring_river)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get player avatar from local storage
|
|
|
|
|
console.log (localStorage.myavatar)
|
|
|
|
|
var img = document.createElement("img");
|
|
|
|
|
img.src = localStorage.myavatar;
|
|
|
|
|
var player_img = document.querySelector("#player_img");
|
|
|
|
|
player_img.appendChild(img);
|
|
|
|
|
|
|
|
|
|
//get player name from local storage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="index.js" ></script>
|
|
|
|
|