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.

515 lines
22 KiB
HTML

4 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 >
4 years ago
<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>
4 years ago
<audio id="explosion"><source src="sound/explosion.wav" type="audio/wav"></audio>
4 years ago
<div class="back" style="display: none;">
Do you want to start from the beginning?<br>
<button id="go_to_start" class="button_back"> yes </button> / <button id="stay"class="button_back"> no </button>
</div>
4 years ago
<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">
4 years ago
<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;">
4 years ago
<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">
4 years ago
<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;">
4 years ago
</div>
<div class="figure2">
4 years ago
<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;">
4 years ago
</div>
<div class="figure3">
4 years ago
<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;">
4 years ago
</div>
<div class="figure4">
4 years ago
<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;">
4 years ago
</div>
4 years ago
<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>
4 years ago
<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;">
4 years ago
The situation is getting dangerous. But remember, you still have the cat steaks with you. <br>
4 years ago
<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;">
4 years ago
Your pawn has been accepted. You are now able to enter the saurians' headquarter.
4 years ago
</div>
</div>
<script src="jquery.min.js"></script>
4 years ago
<script>
var theme = document.querySelector("#theme");
var click = document.querySelector("#click");
4 years ago
var comic = document.querySelector("#comic");
4 years ago
var yes = document.querySelector("#yes");
var shot = document.querySelector("#shot");
4 years ago
var smoke = document.querySelector("#smoke");
var explosion = document.querySelector("#explosion");
4 years ago
4 years ago
theme.volume= 0.3;
click.volume=0.5;
comic.volume= 0.5;
4 years ago
$("body").hover( function() {
theme.play();
theme.addEventListener('paused',function() {
theme.play();
},false);
})
4 years ago
// saves game step in the local storage
window.onload = function() {
4 years ago
theme.play();
4 years ago
theme.addEventListener('paused',function() {
theme.play();
},false);
4 years ago
window.localStorage.setItem("bus_station","opened");
console.log ("bus station:",localStorage.bus_station);
4 years ago
}
//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();
}
4 years ago
4 years ago
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) {
4 years ago
case 83:
$(".back").show();
4 years ago
case 37:
offset.left -= 20;
console.log("left");
break;
case 39:
offset.left += 20;
console.log("right");
break;
}
4 years ago
//go back to start
$("#go_to_start").click( function (){
window.location.href="index.html";
click.play();
});
$("#stay").click( function (){
$(".back").hide();
click.play();
});
4 years ago
//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;
4 years ago
$("#person1").click(function () {
4 years ago
smoke.play();
4 years ago
click_counter ++;
$("#person1").hide();
$("#saurian1").show();
reach_counter()
});
4 years ago
$("#person2").click(function () {
4 years ago
smoke.play();
4 years ago
click_counter ++;
$("#person2").hide();
$("#saurian2").show();
reach_counter()
});
4 years ago
$("#person3").click(function () {
4 years ago
smoke.play();
4 years ago
click_counter ++;
$("#person3").hide();
$("#saurian3").show();
reach_counter()
});
4 years ago
$("#person4").click(function () {
4 years ago
smoke.play();
4 years ago
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();
4 years ago
comic.play();
4 years ago
setTimeout( function () {
4 years ago
comic.play();
4 years ago
$(".bubble2").show();
setTimeout( function () {
4 years ago
click.play();
4 years ago
$(".message2,.message1").hide();
4 years ago
$(".message3, .game_bar, .meat").show();
4 years ago
}, 2000);
4 years ago
}, 3000);
4 years ago
};
}
4 years ago
$(".bubble1").click(function () {
4 years ago
click.play();
4 years ago
$(".bubble1").toggle();
});
$(".bubble2").click(function () {
4 years ago
click.play();
4 years ago
$(".bubble2").toggle();
});
4 years ago
4 years ago
$("#meat1").click(function () {
console.log ("ora!")
4 years ago
yes.play();
4 years ago
$("#meat1").animate({ left: "89%"}, {
duration: 300
}).promise().done(function(){
$("#meat1").hide();
-- cat_meat;
$('.cat_meat_bar').html(cat_meat);
check_meat();
});
});
$("#meat2").click(function () {
4 years ago
yes.play();
4 years ago
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 () {
4 years ago
yes.play();
4 years ago
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 () {
4 years ago
yes.play();
4 years ago
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");
4 years ago
click.play();
4 years ago
setTimeout( function() {
$(".game_bar").hide();
4 years ago
smoke.play();
4 years ago
$(".figure3").animate({ left: "90%"}, {
duration: 500
}).promise().done(function(){
$(".message3").hide();
$(".tunnel, .message4").show();
setTimeout (enter, 2000);
});
}, 1000);
}
};
function enter() {
$("#fighter1").hide();
$("#tunnel1").show();
4 years ago
smoke.play();
4 years ago
$("#tunnel1").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
4 years ago
smoke.play();
4 years ago
$("#tunnel1").hide();
$("#fighter2").hide();
$("#tunnel2").show();
$("#tunnel2").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
4 years ago
smoke.play();
4 years ago
$("#tunnel2").hide();
$("#fighter3").hide();
$("#tunnel3").show();
$("#tunnel3").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
4 years ago
smoke.play();
4 years ago
$("#tunnel3").hide();
$("#fighter4").hide();
$("#tunnel4").show();
$("#tunnel4").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
4 years ago
smoke.play();
4 years ago
$("#tunnel4").hide();
$("#fighter5").hide();
$("#tunnel5").show();
$("#tunnel5").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
4 years ago
smoke.play();
4 years ago
$("#tunnel5").hide();
$("#fighter6").hide();
$("#tunnel6").show();
$("#tunnel6").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
4 years ago
smoke.play();
4 years ago
$("#tunnel6").hide();
$("#fighter7").hide();
$("#tunnel7").show();
$("#tunnel7").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
4 years ago
smoke.play();
4 years ago
$("#tunnel7").hide();
$("#fighter8").hide();
$("#tunnel8").show();
$("#tunnel8").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
4 years ago
smoke.play();
4 years ago
$("#tunnel8").hide();
$("#fighter9").hide();
$("#tunnel9").show();
$("#tunnel9").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
4 years ago
smoke.play();
4 years ago
$("#tunnel9").hide();
$(".army").hide();
$("#player_img").show();
$("#player_img").animate({ top: "100%"}, {
duration: 1000
}).promise().done(function(){
4 years ago
smoke.play();
4 years ago
$("#player_img").hide();
$(".tunnel").hide();
setTimeout( function (){
location.href='saurians_head.html';
}, 1000);
});
});
});
});
});
});
});
});
});
});
}
4 years ago
</script>
<script type="text/javascript" src="index.js" ></script>
</body>