🎮ArcadeLab

Forest Friends: Grumpy Deer Adventure

by LunarFlare59
245 lines8.5 KB
▶ Play

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Grumpy Deer Adventure</title>
<style>
*{box-sizing:border-box}
body{margin:0;background:#bce9a5;color:#254b30;font-family:Trebuchet MS,Arial,sans-serif;text-align:center;user-select:none}
header{padding:12px}
h1{font-size:clamp(26px,6vw,42px);margin:5px}
.game{max-width:850px;margin:auto;padding:12px}
.stats{display:flex;justify-content:center;flex-wrap:wrap;gap:8px}
.stat{background:white;border:3px solid #76b968;border-radius:14px;padding:9px 12px;font-weight:bold;min-width:80px}
.forest{background:linear-gradient(#8bd9ef 0%,#c8efa5 65%,#76bd62 66%);border:5px solid white;border-radius:23px;min-height:330px;padding:12px;display:flex;flex-direction:column;justify-content:space-between;overflow:hidden}
.sky{text-align:right;font-size:30px}
.trees{display:flex;justify-content:space-evenly;align-items:center;flex-wrap:wrap}
.tree{font-size:65px;background:none;border:0;padding:5px;box-shadow:none;cursor:pointer}
.tree:active{transform:scale(.8)}
.deer{font-size:75px;display:none;animation:stomp .4s infinite alternate}
@keyframes stomp{from{transform:rotate(-5deg)}to{transform:rotate(5deg) translateY(-5px)}}
.camp{background:#d8ad77;border:4px solid #a97948;border-radius:50%;width:145px;height:80px;margin:auto;font-size:43px;display:grid;place-items:center}
.message{background:#fff6d5;border:3px solid #e7bd62;border-radius:15px;padding:13px;margin:12px 0;min-height:58px;font-weight:bold}
.actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
button{border:0;border-radius:14px;padding:14px 6px;font-size:16px;font-weight:bold;color:white;background:#398e50;box-shadow:0 4px #24643b;cursor:pointer;touch-action:manipulation}
button:active{transform:translateY(3px);box-shadow:0 1px #24643b}
button:disabled{opacity:.4;cursor:not-allowed;transform:none}
.blue{background:#3689bd;box-shadow:0 4px #23638a}
.orange{background:#ed9639;box-shadow:0 4px #a85e22}
.pink{background:#d879a0;box-shadow:0 4px #984666}
.purple{background:#8665bd;box-shadow:0 4px #574080}
.inventory{background:white;border:3px solid #8acb78;border-radius:15px;padding:12px;margin:12px 0}
.inventory h3{margin:0}
.inventory p{margin:7px}
.overlay{position:fixed;inset:0;background:#153d2cdd;display:none;align-items:center;justify-content:center;padding:20px;z-index:5}
.panel{background:#fff4c9;border:5px solid #e4b755;border-radius:25px;padding:25px;max-width:420px;width:100%}
.panel h2{font-size:30px}
.panel p{font-size:18px;line-height:1.5}
</style>
</head>
<body>
<header>
<h1>🌲 Forest Friends 🌲</h1>
<p>Can you keep your campfire glowing with a grumpy deer nearby?</p>
</header>
<div class="game">
<div class="stats">
<div class="stat">🪵 Wood: <span id="wood">0</span></div>
<div class="stat">🍓 Berries: <span id="berries">0</span></div>
<div class="stat">🔥 Fire: <span id="fuel">0</span></div>
<div class="stat">🌙 Night: <span id="night">0</span>/3</div>
</div>

<div class="forest" id="forest">
<div class="sky" id="sky">☀️</div>
<div class="trees">
<button class="tree" onclick="chop()">🌳</button>
<button class="tree" onclick="chop()">🌲</button>
<button class="tree" onclick="chop()">🌳</button>
<button class="tree" onclick="chop()">🌲</button>
</div>
<div>
<div class="deer" id="deer">🦌😠</div>
<div class="camp" id="camp">🪵</div>
</div>
</div>

<div class="message" id="message">
Welcome, explorer! Tap a tree to collect wood. Watch out for the grumpy deer!
</div>

<div class="inventory">
<h3>🎒 Your Backpack</h3>
<p>🪵 Wood for crafting and fire</p>
<p>🍓 Berries for making friends</p>
<p>🔥 Fire fuel to stay cozy</p>
</div>

<div class="actions">
<button onclick="chop()">🌳 Collect Wood</button>
<button class="pink" onclick="pick()">🍓 Pick Berries</button>
<button class="orange" onclick="craft()" id="craftBtn">🛠️ Craft Campfire (5 wood)</button>
<button class="blue" onclick="addFuel()" id="fuelBtn">🔥 Add Firewood</button>
<button class="pink" onclick="feed()" id="feedBtn" disabled>🍓 Feed Grumpy Deer</button>
<button class="purple" onclick="wave()" id="waveBtn" disabled>👋 Wave Hello</button>
<button onclick="nextNight()" id="nightBtn" disabled>🌙 Welcome Night</button>
<button class="blue" onclick="toggleSound()" id="soundBtn">🔊 Sound On</button>
</div>
<div class="message">
🎯 Mission: Build a campfire with 5 wood. Add 2 wood for each night. Make it through 3 nights!
</div>
</div>

<div class="overlay" id="overlay">
<div class="panel">
<div style="font-size:65px">🏆🔥🦌</div>
<h2>Forest Champion!</h2>
<p>You survived all three nights! Even the grumpy deer thinks you're pretty great!</p>
<button onclick="restart()">🔄 Play Again!</button>
</div>
</div>

<script>
let wood=0,berries=0,fuel=0,night=0;
let built=false,deerHere=false,grumpy=0,gameOver=false;
let soundOn=true,audio=null;

function sound(f=450,d=.12){
 if(!soundOn)return;
 try{
 audio=audio||new(window.AudioContext||window.webkitAudioContext)();
 let o=audio.createOscillator(),g=audio.createGain();
 o.connect(g);g.connect(audio.destination);
 o.frequency.value=f;
 g.gain.setValueAtTime(.07,audio.currentTime);
 g.gain.exponentialRampToValueAtTime(.001,audio.currentTime+d);
 o.start();o.stop(audio.currentTime+d);
 }catch(e){}
}

function say(t){document.getElementById('message').textContent=t}

function update(){
 document.getElementById('wood').textContent=wood;
 document.getElementById('berries').textContent=berries;
 document.getElementById('fuel').textContent=fuel;
 document.getElementById('night').textContent=night;
 document.getElementById('deer').style.display=deerHere?'block':'none';
 document.getElementById('camp').textContent=built?(fuel?'🔥':'🪵'):'🪵';
 document.getElementById('craftBtn').disabled=built||wood<5||gameOver;
 document.getElementById('fuelBtn').disabled=!built||wood<1||gameOver;
 document.getElementById('nightBtn').disabled=!built||fuel<2||gameOver;
 document.getElementById('feedBtn').disabled=!deerHere||berries<1||gameOver;
 document.getElementById('waveBtn').disabled=!deerHere||gameOver;
 document.getElementById('sky').textContent=night===0?'☀️':night===1?'🌅':night===2?'🌙':'🌟';
 document.getElementById('forest').style.background=night===0?
 'linear-gradient(#8bd9ef 0%,#c8efa5 65%,#76bd62 66%)':
 'linear-gradient(#455c91 0%,#8599bd 65%,#52794c 66%)';
}

function surprise(){
 if(!deerHere&&grumpy>=3){
 deerHere=true;
 grumpy=0;
 say('🦌😠 GRRR! The grumpy deer has arrived! "HEY! THAT IS MY FOREST!"');
 sound(180,.25);
 }
 update();
}

function chop(){
 if(gameOver)return;
 if(deerHere){
 say('🦌😠 The deer is blocking the trees! "NO CHOPPING WHILE I AM HERE!"');
 sound(180);
 return;
 }
 wood++;
 grumpy++;
 sound(500);
 say('🌳 Great job! You collected one piece of wood!');
 surprise();
}

function pick(){
 if(gameOver)return;
 berries++;
 sound(650);
 say('🍓 You picked a juicy berry! Maybe the grumpy deer will like it.');
 update();
}

function craft(){
 if(gameOver||built||wood<5)return;
 wood-=5;
 built=true;
 sound(700,.3);
 say('🔥 Hooray! Your cozy campfire is ready! Now add firewood.');
 update();
}

function addFuel(){
 if(gameOver||!built||wood<1)return;
 wood--;
 fuel++;
 sound(550);
 say('🔥 You added a log! The fire is glowing!');
 update();
}

function feed(){
 if(gameOver||!deerHere||berries<1)return;
 berries--;
 deerHere=false;
 wood+=2;
 sound(800,.25);
 say('🦌🍓 NOM NOM! The deer loves berries! It gives you 2 wood. "I AM STILL GRUMPY THOUGH!"');
 update();
}

function wave(){
 if(gameOver||!deerHere)return;
 deerHere=false;
 sound(300);
 say('🦌😠 "HMPH!" The deer stomps away. It drops a piece of wood while grumbling!');
 wood++;
 update();
}

function nextNight(){
 if(gameOver||!built||fuel<2)return;
 fuel-=2;
 night++;
 sound(350,.3);
 if(night===3){
 gameOver=true;
 say('🌟 YOU DID IT! Three cozy nights!');
 document.getElementById('overlay').style.display='flex';
 }else{
 say('🌙 Night '+night+' is complete! Your campfire kept you warm. The deer is watching from behind a tree!');
 deerHere=false;
 }
 update();
}

function restart(){
 wood=0;berries=0;fuel=0;night=0;
 built=false;deerHere=false;grumpy=0;gameOver=false;
 document.getElementById('overlay').style.display='none';
 say('Welcome back, explorer! Collect wood and watch out for the grumpy deer!');
 update();
}

function toggleSound(){
 soundOn=!soundOn;
 document.getElementById('soundBtn').textContent=soundOn?'🔊 Sound On':'🔇 Sound Off';
 if(soundOn)sound(600);
}

update();
</script>
</body>
</html>

Game Source: Forest Friends: Grumpy Deer Adventure

Creator: LunarFlare59

Libraries: none

Complexity: complex (245 lines, 8.5 KB)

The full source code is displayed above on this page.

Remix Instructions

To remix this game, copy the source code above and modify it. Add a ARCADELAB header at the top with "remix_of: forest-friends-grumpy-deer-adventure-lunarflare59" to link back to the original. Then publish at arcadelab.ai/publish.