You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

280 lines
8.9 KiB
HTML

3 years ago
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>bus station</title>
<link rel="icon" href="imgs/bus_station/car1.gif">
<link rel="stylesheet" href="bus_station.css">
</head>
<body >
<div class="game_bar invert" style="display: none;">
cat steaks: <span class="cat_meat_bar"></span> / 4
</div>
<div id="ground_color" class="invert"></div>
<div id="groundline" class="invert"></div>
<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">
<img id="fighter4" src="imgs/spring_river/fighter4.gif" height="120px">
<img id="fighter5" src="imgs/spring_river/fighter5.gif" height="120px">
<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="150px">
</div>
<div id="ground">
<div class="bus1">
<img id="bus1" src="imgs/bus_station/car2.gif" height="90px">
<img id="bus_fire1" src="imgs/bus_station/car2_fire.gif" height="90px"style="display: none;">
</div>
<div class="bus2">
<img id="bus2" src="imgs/bus_station/bus2.gif" height="130px">
<img id="bus_fire2" src="imgs/bus_station/bus2_fire.gif" height="130px"style="display: none;">
</div>
<div class="bus3">
<img id="bus3" src="imgs/bus_station/car3.gif" height="90px">
<img id="bus_fire3" src="imgs/bus_station/car3_fire.gif" height="90px"style="display: none;">
</div>
<div class="bus4">
<img id="bus4" src="imgs/bus_station/bus2.gif" height="130px">
<img id="bus_fire4" src="imgs/bus_station/bus2_fire.gif" height="130px"style="display: none;">
</div>
<div class="bus5">
<img id="bus5" src="imgs/bus_station/car2.gif" height="100px">
<img id="bus_fire5" src="imgs/bus_station/car2_fire.gif" height="100px"style="display: none;">
</div>
<div class="bus6">
<img id="bus6" src="imgs/bus_station/bus2.gif" height="130px">
<img id="bus_fire6" src="imgs/bus_station/bus2_fire.gif" height="130px"style="display: none;">
</div>
<div class="bus7">
<img id="bus7" src="imgs/bus_station/car2.gif" height="90px">
<img id="bus_fire7" src="imgs/bus_station/car2_fire.gif" height="90px"style="display: none;">
</div>
<div class="bus8">
<img id="bus8" src="imgs/bus_station/bus2.gif" height="130px">
<img id="bus_fire8" src="imgs/bus_station/bus2_fire.gif" height="130px"style="display: none;">
</div>
<img id="warehouse" src="imgs/bus_station/warehouse4.png" height="260px">
<div class="figure1">
<img id="person1" src="imgs/bus_station/guard_human1.gif" height="80px">
<img id="saurian1" src="imgs/bus_station/guard_rept1.gif" height="100px" style="display: none;">
</div>
<div class="figure2">
<img id="person2" src="imgs/bus_station/guard_human2.gif" height="130px">
<img id="saurian2" src="imgs/bus_station/guard_rept2.gif" height="110px" style="display: none;">
</div>
<div class="figure3">
<img id="person3" src="imgs/bus_station/guard_human3.gif" height="110px">
<img id="saurian3" src="imgs/bus_station/guard_rept3.gif" height="115px" style="display: none;">
</div>
<div class="figure4">
<img id="person4" src="imgs/bus_station/guard_human4.gif" height="100px">
<img id="saurian4" src="imgs/bus_station/guard_rept4.gif" height="120px" style="display: none;">
</div>
<div class="bubble1 invert"style="display: none;"><span id="player_name"></span>, this is a guarded entrance. No one from your world is allowed to pass.</div>
<div class="bubble2 invert"style="display: none;">Unless you are able to pay us back with your pound of flesh. </div>
<div class="text_container invert">
<div class="message1">
You are approaching the bus station. The entrance of the saurian headquarter should be somewhere around here.<br>
<span class="instructions"><span class="instructions_arrow"></span> Move around with your army to find the entrance!</span>
</div>
<div class="message2" style="display: none;">
These people look suspicious. They seem to be guarding the entrance of that warehouse.
</div>
<div class="message3" style="display: none;">
The situation is getting dangerous. But remember, you still have the kitten steaks with you. <br>
<span class="instructions"><span class="instructions_arrow"></span> Use them to pay the entry fee for you and your buddies</span>
</div>
<div class="message4" style="display: none;">
Your pawn has been accepted by the saurian guards. You are now able to enter the headquarter.
</div>
</div>
<script src="jquery.min.js"></script>
<script>
// 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
document.querySelector('#player_name').innerHTML = localStorage.playerName;
//adjust camera scroll
var $div = $('.army');
var screenLeftMin = 50;
var screenLeftMax = 400;
function adjustScroll() {
var playerLeft = parseInt($div.css("left"));
var scrollLeft = $(document).scrollLeft();
var screenLeft = playerLeft - scrollLeft;
console.log ("screenleft:", screenLeft);
if (screenLeft > screenLeftMax ) {
$(document).scrollLeft(playerLeft - screenLeftMax)
}
if (screenLeft < screenLeftMin ) {
$(document).scrollLeft(playerLeft - screenLeftMin)
}
}
//move the character
$(document).keydown(function(e) {
var offset = $div.position();
console.log("offset:", offset);
// 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 (left_Percentage >= 7) {
$("#bus1,#bus2").hide();
$("#bus_fire1, #bus_fire2").show();
}
if (left_Percentage >= 24) {
$("#bus3").hide();
$("#bus_fire3").show();
}
if (left_Percentage >= 33) {
$("#bus4").hide();
$("#bus_fire4").show();
}
if (left_Percentage >= 52) {
$("#bus5,#bus6").hide();
$("#bus_fire5, #bus_fire6").show();
}
if (left_Percentage >= 72) {
$("#bus7,#bus8").hide();
$("#bus_fire7, #bus_fire8").show();
}
switch (e.which) {
case 37:
offset.left -= 20;
console.log("left");
break;
case 39:
offset.left += 20;
console.log("right");
break;
}
//check the offset and prevent the character to exceed the screen dimension
if (offset.left < 80) {
offset.left = 80;
}
if (offset.left > $("#ground").width() - 1200) {
offset.left = $("#ground").width() - 1200;
$(document).scrollLeft(4000);
$(".message1").hide();
$(".message2").show();
}
$div.css("left", offset.left);
$div.css("top", offset.top);
e.preventDefault();
adjustScroll();
})
var click_counter = 0;
$(".figure1").click(function () {
click_counter ++;
$("#person1").hide();
$("#saurian1").show();
reach_counter()
});
$(".figure2").click(function () {
click_counter ++;
$("#person2").hide();
$("#saurian2").show();
reach_counter()
});
$(".figure3").click(function () {
click_counter ++;
$("#person3").hide();
$("#saurian3").show();
reach_counter()
});
$(".figure4").click(function () {
click_counter ++;
$("#person4").hide();
$("#saurian4").show();
reach_counter()
});
var cat_meat = 4;
$('.cat_meat_bar').html(cat_meat);
function reach_counter() {
if ( click_counter == 4 ) {
$(".bubble1").show();
setTimeout( function () {
$(".bubble2").show();
setTimeout( function () {
$(".message2,.message1").hide();
$(".message3, .game_bar").show();
}, 2000);
}, 2000);
};
}
</script>
<script type="text/javascript" src="index.js" ></script>
</body>