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.
332 lines
11 KiB
HTML
332 lines
11 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>looking for</title>
|
||
|
<link rel="icon" href="imgs/park/flower2.gif">
|
||
4 years ago
|
<link rel="stylesheet" href="park_walk.css">
|
||
4 years ago
|
|
||
|
</head>
|
||
|
<body>
|
||
4 years ago
|
<audio loop="loop" id="theme1" preload="auto"><source src="sound/theme1.wav" type="audio/wav"></audio>
|
||
|
<audio id="page"><source src="sound/page.wav" type="audio/wav"></audio>
|
||
|
<audio id="click"><source src="sound/click.wav" type="audio/wav"></audio>
|
||
|
<audio id="comic"><source src="sound/speech.wav" type="audio/wav"></audio>
|
||
|
<audio id="comic_ned"><source src="sound/ned_speech.wav" type="audio/wav"></audio>
|
||
|
<audio id="bark"><source src="sound/bark.wav" type="audio/wav"></audio>
|
||
4 years ago
|
<audio id="smoke"><source src="sound/smoke.wav" type="audio/wav"></audio>
|
||
|
|
||
4 years ago
|
|
||
4 years ago
|
|
||
|
<div id="groundline"></div>
|
||
4 years ago
|
|
||
|
<div id="ground">
|
||
4 years ago
|
<div id="player_img"></div>
|
||
4 years ago
|
<div id="player_img"></div>
|
||
4 years ago
|
<img id="cat" src="imgs/park/cat.gif" height="40px" style="display: none;">
|
||
|
<img id="snake" src="imgs/park/snake.gif" height="40px" style="display: none;">
|
||
4 years ago
|
<img id="bench" src="imgs/park/bench.gif" height="150px">
|
||
|
<img id="tree1" src="imgs/park/tree1.gif" height="200px">
|
||
|
<img id="tree2" src="imgs/park/tree4.gif" height="160px">
|
||
|
<img id="tree3" src="imgs/park/tree4.gif" height="160px">
|
||
4 years ago
|
<img id="tree3_5" src="imgs/park/tree1.gif" height="200px">
|
||
4 years ago
|
<img id="flower1" src="imgs/park/flower1.gif" height="30px">
|
||
|
<img id="flower2" src="imgs/park/flower3.gif" height="40px">
|
||
|
<img id="flower3" src="imgs/park/flower3.1.gif" height="40px">
|
||
|
<img id="flower4" src="imgs/park/flower1.1.gif" height="30px">
|
||
|
<img id="flower5" src="imgs/park/flower1.gif" height="30px">
|
||
4 years ago
|
<img id="grass1" src="imgs/park/grass1.gif" height="90px">
|
||
4 years ago
|
<img id="statue" src="imgs/park/statue.gif" height="150px">
|
||
|
<img id="tree4" src="imgs/park/tree4.gif" height="160px">
|
||
|
<img id="flower6" src="imgs/park/flower1.1.gif" height="30px">
|
||
|
<img id="flower7" src="imgs/park/flower3.1.gif" height="40px">
|
||
|
<img id="flower8" src="imgs/park/flower3.1.gif" height="40px">
|
||
|
<img id="tree5" src="imgs/park/tree1.gif" height="230px">
|
||
|
<img id="sport1" src="imgs/park/fitness1.gif" height="70px">
|
||
|
<img id="sport2" src="imgs/park/fitness2.gif" height="70px">
|
||
4 years ago
|
<img id="newspaper_seller" src="imgs/park/newspaper_seller.gif" height="110px">
|
||
|
<img id="woman" src="imgs/park/woman.gif" height="120px">
|
||
4 years ago
|
<img id="flower9" src="imgs/park/flower1.1.gif" height="30px">
|
||
4 years ago
|
<img id="dog" src="imgs/park/dog1.gif" height="80px">
|
||
|
<img id="ned" src="imgs/park/ned2.gif" height="110px">
|
||
4 years ago
|
<img id="grass2" src="imgs/park/grass1.gif" height="90px">
|
||
4 years ago
|
|
||
4 years ago
|
<div class="woman_bubble" style="display: none;">I don't know, you should try to ask the news vendor ■</div>
|
||
|
<div class="dog_bubble" style="display: none;">Have you heard what happened to the cats? ✜</div>
|
||
|
<div class="dog_bubble2" style="display: none;">It looks like they ran away from the cat shelter tonight ■</div>
|
||
|
<div class="vendor_bubble" style="display: none;">I sold a copy to a guy not so long ago. He must be still around ■</div>
|
||
|
<div class="fit2_bubble" style="display: none;">■</div>
|
||
|
<div class="fit1_bubble" style="display: none;">■</div>
|
||
|
<div class="ned_bubble1" style="display: none;">I was hoping that someone would find my newspaper ✜</div>
|
||
|
<div class="ned_bubble2" style="display: none;">My name is Ned, I used to be the school's janitor. I got fired last week because the school noticed I was investigating the kids' conditions. Believe me, the situation is shadier than it looks. Do you wanna know what I just found out? ✜</div>
|
||
|
<div class="ned_bubble3" style="display: none;">The school is involved in sinister activities: together with the Monteferro Food Enterprise they are poisoning the children's meals. Follow me to the enterprise's fields: I can show you the proof that what I'm saying is true ■</div>
|
||
4 years ago
|
|
||
|
</div>
|
||
4 years ago
|
|
||
|
<div class="text_container">
|
||
4 years ago
|
<div class="message1 instructions">
|
||
4 years ago
|
<span class="instructions_arrow">→</span> Move around the park with the arrows ←↑↓→
|
||
4 years ago
|
</div>
|
||
4 years ago
|
<div class="message_dog" style="display: none;">
|
||
|
Amanda might be at the cat shelter. <button onclick="location.href='cat_shelter.html';"><span class="button_text">Go there to check it out !</span></button>
|
||
|
</div>
|
||
4 years ago
|
<div class="message2" style="display: none;">
|
||
4 years ago
|
You found him!
|
||
4 years ago
|
</div>
|
||
|
<div class="message3" style="display: none;">
|
||
|
It looks intriguing: <button onclick="location.href='monteferro.html';"><span class="button_text">go to the Monteferro Food Enterprise</span></button> with Ned.
|
||
4 years ago
|
</div>
|
||
4 years ago
|
</div>
|
||
|
|
||
|
|
||
|
<script src="jquery.min.js"></script>
|
||
|
<script>
|
||
4 years ago
|
// audio
|
||
|
var theme = document.querySelector("#theme1");
|
||
|
var page = document.querySelector("#page");
|
||
|
var click = document.querySelector("#click");
|
||
|
var comic = document.querySelector("#comic");
|
||
|
var comic_ned = document.querySelector("#comic_ned");
|
||
|
var bark = document.querySelector("#bark");
|
||
4 years ago
|
var smoke = document.querySelector("#smoke");
|
||
4 years ago
|
|
||
|
|
||
|
$("body").hover( function() {
|
||
|
theme.play();
|
||
|
theme.addEventListener('paused',function() {
|
||
|
theme.play();
|
||
|
},false);
|
||
|
})
|
||
4 years ago
|
|
||
4 years ago
|
//adjust camera scroll
|
||
4 years ago
|
var $div = $('#player_img');
|
||
4 years ago
|
var screenLeftMin = 200;
|
||
4 years ago
|
var screenLeftMax = 870;
|
||
|
|
||
|
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)
|
||
|
}
|
||
4 years ago
|
|
||
4 years ago
|
}
|
||
4 years ago
|
|
||
4 years ago
|
|
||
4 years ago
|
//move the character
|
||
4 years ago
|
|
||
4 years ago
|
$(document).keydown(function(e) {
|
||
4 years ago
|
var offset = $div.position();
|
||
4 years ago
|
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);
|
||
4 years ago
|
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 > 20) {
|
||
|
$("#snake").show();
|
||
|
$("#snake").animate({ top: "120%" }, {
|
||
|
duration: 2000
|
||
|
}).promise().done(function(){
|
||
|
$("#snake").hide();
|
||
|
});
|
||
|
}
|
||
|
|
||
4 years ago
|
if (left_Percentage == 20) {
|
||
|
smoke.play();
|
||
|
}
|
||
|
|
||
4 years ago
|
if (left_Percentage > 70) {
|
||
|
$("#cat").addClass("flipped");
|
||
4 years ago
|
$("#cat").show();
|
||
4 years ago
|
$("#cat").animate({ left: "20%" }, {
|
||
|
duration: 1500
|
||
4 years ago
|
}).promise().done(function(){
|
||
4 years ago
|
$("#cat").hide();
|
||
4 years ago
|
});
|
||
|
}
|
||
4 years ago
|
|
||
|
if (left_Percentage == 70) {
|
||
|
smoke.play();
|
||
|
}
|
||
4 years ago
|
|
||
|
if (top_Percentage > 65) {
|
||
|
$div.css ("zIndex", 5)
|
||
|
}
|
||
|
if (top_Percentage < 55 && top_Percentage > 39) {
|
||
|
$div.css ("zIndex", 4)
|
||
|
}
|
||
|
if (top_Percentage < 39) {
|
||
|
$div.css ("zIndex", 1)
|
||
|
}
|
||
|
|
||
|
|
||
4 years ago
|
|
||
4 years ago
|
switch (e.which) {
|
||
|
case 37:
|
||
4 years ago
|
offset.left -= 20;
|
||
|
console.log("left");
|
||
4 years ago
|
$div.addClass("flipped");
|
||
4 years ago
|
$(".message1").hide();
|
||
4 years ago
|
break;
|
||
4 years ago
|
case 38:
|
||
4 years ago
|
offset.top -= 20;
|
||
|
console.log("top");
|
||
4 years ago
|
$(".message1").hide();
|
||
4 years ago
|
break;
|
||
|
case 39:
|
||
4 years ago
|
offset.left += 20;
|
||
|
console.log("right");
|
||
4 years ago
|
$div.removeClass("flipped");
|
||
4 years ago
|
$(".message1").hide();
|
||
4 years ago
|
break;
|
||
|
case 40:
|
||
4 years ago
|
offset.top += 20;
|
||
|
console.log("down");
|
||
4 years ago
|
$(".message1").hide();
|
||
4 years ago
|
break;
|
||
4 years ago
|
}
|
||
4 years ago
|
//check the offset and prevent the character to exceed the screen dimension
|
||
4 years ago
|
if (offset.left < 80) {
|
||
|
offset.left = 80;
|
||
4 years ago
|
}
|
||
4 years ago
|
if (offset.left > $("#ground").width() - 250) {
|
||
|
offset.left = $("#ground").width() - 250;
|
||
4 years ago
|
|
||
|
}
|
||
|
|
||
4 years ago
|
if (offset.top < 130) {
|
||
|
offset.top = 130;
|
||
4 years ago
|
}
|
||
4 years ago
|
if (offset.top > $("#ground").height() - 250) {
|
||
|
offset.top = $("#ground").height() - 250;
|
||
4 years ago
|
|
||
|
}
|
||
|
|
||
|
$div.css("left", offset.left);
|
||
|
$div.css("top", offset.top);
|
||
|
e.preventDefault();
|
||
|
adjustScroll();
|
||
|
|
||
4 years ago
|
})
|
||
4 years ago
|
|
||
4 years ago
|
|
||
|
// saves game step in the local storage
|
||
|
window.onload = function() {
|
||
4 years ago
|
theme.play();
|
||
4 years ago
|
window.localStorage.setItem("looking_for_N","opened")
|
||
|
console.log ("looking for N:",localStorage.looking_for_N)
|
||
|
}
|
||
|
|
||
|
//get player avatar from local storage
|
||
4 years ago
|
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
|
||
|
|
||
|
|
||
4 years ago
|
$("#woman").click (function(){
|
||
4 years ago
|
comic.play();
|
||
4 years ago
|
$(".woman_bubble").show();
|
||
|
});
|
||
|
$(".woman_bubble").click (function(){
|
||
4 years ago
|
click.play();
|
||
4 years ago
|
$(".woman_bubble").toggle();
|
||
|
});
|
||
|
|
||
4 years ago
|
$("#dog").click (function(){
|
||
4 years ago
|
bark.play();
|
||
4 years ago
|
$(".dog_bubble").toggle();
|
||
|
});
|
||
|
|
||
4 years ago
|
$(".dog_bubble").click (function(){
|
||
4 years ago
|
bark.play();
|
||
4 years ago
|
$(".message1, .dog_bubble").hide();
|
||
4 years ago
|
$(".dog_bubble2, .message_dog").toggle();
|
||
4 years ago
|
});
|
||
|
|
||
|
$(".dog_bubble2").click (function(){
|
||
4 years ago
|
click.play();
|
||
4 years ago
|
$(".message1").hide();
|
||
|
$(".message_dog, .dog_bubble2").toggle();
|
||
4 years ago
|
});
|
||
|
|
||
4 years ago
|
$("#newspaper_seller").click (function(){
|
||
4 years ago
|
comic.play();
|
||
4 years ago
|
$(".vendor_bubble").show();
|
||
|
});
|
||
|
$(".vendor_bubble").click (function(){
|
||
4 years ago
|
click.play();
|
||
4 years ago
|
$(".vendor_bubble").toggle();
|
||
|
});
|
||
4 years ago
|
|
||
4 years ago
|
$("#sport1").click (function(){
|
||
4 years ago
|
comic.play();
|
||
4 years ago
|
$(".fit2_bubble").show();
|
||
|
});
|
||
|
$(".fit2_bubble").click (function(){
|
||
4 years ago
|
click.play();
|
||
4 years ago
|
$(".fit2_bubble").toggle();
|
||
|
});
|
||
|
|
||
|
$("#sport2").click (function(){
|
||
4 years ago
|
comic.play();
|
||
4 years ago
|
$(".fit1_bubble").show();
|
||
|
});
|
||
|
$(".fit1_bubble").click (function(){
|
||
4 years ago
|
click.play();
|
||
4 years ago
|
$(".fit1_bubble").toggle();
|
||
|
});
|
||
|
|
||
|
$("#ned").click (function(){
|
||
4 years ago
|
comic_ned.play();
|
||
4 years ago
|
$(".ned_bubble1").show();
|
||
4 years ago
|
$(".message2").show();
|
||
4 years ago
|
$(".message1").hide();
|
||
4 years ago
|
});
|
||
|
|
||
|
$(".ned_bubble1").click (function(){
|
||
4 years ago
|
comic_ned.play();
|
||
4 years ago
|
$(".ned_bubble2").show();
|
||
|
$(".ned_bubble1").hide();
|
||
4 years ago
|
});
|
||
|
|
||
4 years ago
|
$(".ned_bubble2").click (function(){
|
||
4 years ago
|
comic_ned.play();
|
||
4 years ago
|
$(".ned_bubble2").toggle();
|
||
|
$(".ned_bubble3").show();
|
||
4 years ago
|
$(".message2").hide();
|
||
4 years ago
|
$(".message3").show();
|
||
|
});
|
||
|
|
||
|
$(".ned_bubble3").click (function(){
|
||
4 years ago
|
click.play();
|
||
4 years ago
|
$(".ned_bubble3").toggle();
|
||
4 years ago
|
});
|
||
|
|
||
4 years ago
|
|
||
|
</script>
|
||
4 years ago
|
|
||
4 years ago
|
<script type="text/javascript" src="index.js" ></script>
|
||
4 years ago
|
|
||
4 years ago
|
|
||
|
</body>
|