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.

493 lines
22 KiB
HTML

<!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 >
<audio loop="loop" id="theme" preload="auto"><source src="sound/theme3_danger.mp3" type="audio/mp3"></audio>
<audio id="click"><source src="sound/click.wav" type="audio/wav"></audio>
<audio id="comic"><source src="sound/alien_speech.wav" type="audio/wav"></audio>
<audio id="yes"><source src="sound/yes.wav" type="audio/wav"></audio>
<audio id="smoke"><source src="sound/smoke.wav" type="audio/wav"></audio>
<audio id="shot"><source src="sound/shot.wav" type="audio/wav"></audio>
<audio id="explosion"><source src="sound/explosion.wav" type="audio/wav"></audio>
<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">
<svg class="tunnel invert" style="display: none;">
<line x1="93%" y1="40%" x2="93%" y2="110%"/>
<line x1="97.4%" y1="40%" x2="97.4%" y2="110%"/>
</svg>
<div id="player_img" class="tunnel_people"></div>
<img id="tunnel1" class="tunnel_people" src="imgs/spring_river/fighter1.gif" height="120px" >
<img id="tunnel2" class="tunnel_people" src="imgs/spring_river/fighter2.gif" height="120px">
<img id="tunnel3" class="tunnel_people" src="imgs/spring_river/fighter3.gif" height="120px">
<img id="tunnel4" class="tunnel_people" src="imgs/spring_river/fighter4.gif" height="120px">
<img id="tunnel5" class="tunnel_people" src="imgs/spring_river/fighter5.gif" height="120px">
<img id="tunnel6" class="tunnel_people" src="imgs/spring_river/fighter6.gif" height="110px">
<img id="tunnel7" class="tunnel_people" src="imgs/spring_river/fighter7.gif" height="120px">
<img id="tunnel8" class="tunnel_people" src="imgs/spring_river/fighter8.gif" height="120px">
<img id="meat1" class="meat" src="imgs/bus_station/meat.gif" height="50px" style="display: none;">
<img id="meat2" class="meat" src="imgs/bus_station/meat.gif" height="50px" style="display: none;">
<img id="meat3" class="meat" src="imgs/bus_station/meat.gif" height="50px" style="display: none;">
<img id="meat4" class="meat" src="imgs/bus_station/meat.gif" height="50px" style="display: none;">
<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" class="people" src="imgs/bus_station/guard_human1.gif" height="80px">
<img id="saurian1" class="saurians" src="imgs/bus_station/guard_rept1.gif" height="100px" style="display: none;">
</div>
<div class="figure2">
<img id="person2" class="people" src="imgs/bus_station/guard_human2.gif" height="130px">
<img id="saurian2" class="saurians" src="imgs/bus_station/guard_rept2.gif" height="110px" style="display: none;">
</div>
<div class="figure3">
<img id="person3" class="people" src="imgs/bus_station/guard_human3.gif" height="110px">
<img id="saurian3" class="saurians" src="imgs/bus_station/guard_rept3.gif" height="115px" style="display: none;">
</div>
<div class="figure4">
<img id="person4" class="people" src="imgs/bus_station/guard_human4.gif" height="100px">
<img id="saurian4" class="saurians" 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 cat 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. You are now able to enter the saurians' headquarter.
</div>
</div>
<script src="jquery.min.js"></script>
<script>
var theme = document.querySelector("#theme");
theme.volume= 0.2;
var click = document.querySelector("#click");
var comic = document.querySelector("#comic");
comic.volume= 0.5;
var yes = document.querySelector("#yes");
var shot = document.querySelector("#shot");
var smoke = document.querySelector("#smoke");
var explosion = document.querySelector("#explosion");
$("body").hover( function() {
theme.play();
theme.addEventListener('paused',function() {
theme.play();
},false);
})
// saves game step in the local storage
window.onload = function() {
theme.play();
window.localStorage.setItem("bus_station","opened");
console.log ("bus station:",localStorage.bus_station);
}
//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;
$("#person1").click(function () {
click.play();
click_counter ++;
$("#person1").hide();
$("#saurian1").show();
reach_counter()
});
$("#person2").click(function () {
click.play();
click_counter ++;
$("#person2").hide();
$("#saurian2").show();
reach_counter()
});
$("#person3").click(function () {
click.play();
click_counter ++;
$("#person3").hide();
$("#saurian3").show();
reach_counter()
});
$("#person4").click(function () {
click.play();
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();
comic.play();
setTimeout( function () {
comic.play();
$(".bubble2").show();
setTimeout( function () {
click.play();
$(".message2,.message1").hide();
$(".message3, .game_bar, .meat").show();
}, 2000);
}, 3000);
};
}
$(".bubble1").click(function () {
click.play();
$(".bubble1").toggle();
});
$(".bubble2").click(function () {
click.play();
$(".bubble2").toggle();
});
$("#meat1").click(function () {
console.log ("ora!")
yes.play();
$("#meat1").animate({ left: "89%"}, {
duration: 300
}).promise().done(function(){
$("#meat1").hide();
-- cat_meat;
$('.cat_meat_bar').html(cat_meat);
check_meat();
});
});
$("#meat2").click(function () {
yes.play();
console.log ("ora!")
$("#meat2").animate({ left: "87%"}, {
duration: 300
}).promise().done(function(){
$("#meat2").hide();
-- cat_meat;
$('.cat_meat_bar').html(cat_meat);
check_meat();
});
});
$("#meat3").click(function () {
yes.play();
console.log ("ora!")
$("#meat3").animate({ left: "95%"}, {
duration: 300
}).promise().done(function(){
$("#meat3").hide();
-- cat_meat;
$('.cat_meat_bar').html(cat_meat);
check_meat();
});
});
$("#meat4").click(function () {
yes.play();
console.log ("ora!")
$("#meat4").animate({ left: "88%"}, {
duration: 300
}).promise().done(function(){
$("#meat4").hide();
-- cat_meat;
$('.cat_meat_bar').html(cat_meat);
check_meat();
});
});
function check_meat() {
if (cat_meat == 3) {
$(".bubble1, .bubble2").hide();
} if (cat_meat == 0) {
console.log("carne finita");
$(".game_bar").addClass("game_bar_glow");
click.play();
setTimeout( function() {
$(".game_bar").hide();
smoke.play();
$(".figure3").animate({ left: "90%"}, {
duration: 500
}).promise().done(function(){
$(".message3").hide();
$(".tunnel, .message4").show();
setTimeout (enter, 2000);
});
}, 1000);
}
};
function enter() {
$("#fighter1").hide();
$("#tunnel1").show();
smoke.play();
$("#tunnel1").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
smoke.play();
$("#tunnel1").hide();
$("#fighter2").hide();
$("#tunnel2").show();
$("#tunnel2").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
smoke.play();
$("#tunnel2").hide();
$("#fighter3").hide();
$("#tunnel3").show();
$("#tunnel3").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
smoke.play();
$("#tunnel3").hide();
$("#fighter4").hide();
$("#tunnel4").show();
$("#tunnel4").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
smoke.play();
$("#tunnel4").hide();
$("#fighter5").hide();
$("#tunnel5").show();
$("#tunnel5").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
smoke.play();
$("#tunnel5").hide();
$("#fighter6").hide();
$("#tunnel6").show();
$("#tunnel6").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
smoke.play();
$("#tunnel6").hide();
$("#fighter7").hide();
$("#tunnel7").show();
$("#tunnel7").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
smoke.play();
$("#tunnel7").hide();
$("#fighter8").hide();
$("#tunnel8").show();
$("#tunnel8").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
smoke.play();
$("#tunnel8").hide();
$("#fighter9").hide();
$("#tunnel9").show();
$("#tunnel9").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
smoke.play();
$("#tunnel9").hide();
$(".army").hide();
$("#player_img").show();
$("#player_img").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
smoke.play();
$("#player_img").hide();
$(".tunnel").hide();
setTimeout( function (){
location.href='saurians_head.html';
}, 1000);
});
});
});
});
});
});
});
});
});
});
}
</script>
<script type="text/javascript" src="index.js" ></script>
</body>