Spaces:
Running
Running
Make a physics based 3rd person game where the player defends a picknick blanket in a park from diffrent stray animals that keeps tipping things over and steals the food.
Browse filesThe character can pick the animals up and throw them away or scare them away.
The players job is to make a pretty picknick by unpacking the picknick basket and place place, utensils, cups, glass, thermos, bottles nicely to prepare for a date.
The physics should involve alot of ragdoll effects.
- README.md +8 -5
- index.html +330 -18
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title: Picnic Panic Pals
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Picnic Panic Pals 🧺
|
| 3 |
+
colorFrom: red
|
| 4 |
+
colorTo: purple
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://deepsite.hf.co).
|
index.html
CHANGED
|
@@ -1,19 +1,331 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Picnic Panic Pals</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
| 12 |
+
<script src="https://cdn.jsdelivr.net/npm/cannon-es@0.19.0/dist/cannon-es.min.js"></script>
|
| 13 |
+
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
|
| 14 |
+
<style>
|
| 15 |
+
#gameCanvas {
|
| 16 |
+
position: absolute;
|
| 17 |
+
top: 0;
|
| 18 |
+
left: 0;
|
| 19 |
+
width: 100%;
|
| 20 |
+
height: 100%;
|
| 21 |
+
z-index: -1;
|
| 22 |
+
}
|
| 23 |
+
.ragdoll {
|
| 24 |
+
transition: all 0.3s ease;
|
| 25 |
+
}
|
| 26 |
+
.food-item {
|
| 27 |
+
cursor: grab;
|
| 28 |
+
transition: transform 0.2s;
|
| 29 |
+
}
|
| 30 |
+
.food-item:active {
|
| 31 |
+
cursor: grabbing;
|
| 32 |
+
transform: scale(1.1);
|
| 33 |
+
}
|
| 34 |
+
</style>
|
| 35 |
+
</head>
|
| 36 |
+
<body class="bg-green-50 overflow-hidden">
|
| 37 |
+
<canvas id="gameCanvas"></canvas>
|
| 38 |
+
|
| 39 |
+
<div class="min-h-screen flex flex-col items-center justify-center p-4">
|
| 40 |
+
<div class="bg-white bg-opacity-90 rounded-3xl shadow-2xl p-8 max-w-4xl w-full">
|
| 41 |
+
<div class="flex justify-between items-center mb-6">
|
| 42 |
+
<h1 class="text-4xl font-bold text-green-700">Picnic Panic Pals</h1>
|
| 43 |
+
<div class="flex items-center space-x-4">
|
| 44 |
+
<div class="bg-yellow-100 px-4 py-2 rounded-full flex items-center">
|
| 45 |
+
<i data-feather="clock" class="text-yellow-600 mr-2"></i>
|
| 46 |
+
<span class="font-bold text-yellow-800" id="timer">03:00</span>
|
| 47 |
+
</div>
|
| 48 |
+
<div class="bg-red-100 px-4 py-2 rounded-full flex items-center">
|
| 49 |
+
<i data-feather="heart" class="text-red-600 mr-2"></i>
|
| 50 |
+
<span class="font-bold text-red-800" id="dateMeter">❤️ 100%</span>
|
| 51 |
+
</div>
|
| 52 |
+
</div>
|
| 53 |
+
</div>
|
| 54 |
+
|
| 55 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
|
| 56 |
+
<div class="bg-green-100 rounded-2xl p-6">
|
| 57 |
+
<h2 class="text-2xl font-semibold text-green-800 mb-4">Your Picnic Setup</h2>
|
| 58 |
+
<div class="grid grid-cols-3 gap-3">
|
| 59 |
+
<div class="food-item bg-white p-3 rounded-lg shadow-md flex flex-col items-center justify-center ragdoll" draggable="true">
|
| 60 |
+
<i data-feather="coffee" class="text-amber-700 w-8 h-8"></i>
|
| 61 |
+
<span class="text-xs mt-1">Thermos</span>
|
| 62 |
+
</div>
|
| 63 |
+
<div class="food-item bg-white p-3 rounded-lg shadow-md flex flex-col items-center justify-center ragdoll" draggable="true">
|
| 64 |
+
<i data-feather="pie-chart" class="text-red-500 w-8 h-8"></i>
|
| 65 |
+
<span class="text-xs mt-1">Pie</span>
|
| 66 |
+
</div>
|
| 67 |
+
<div class="food-item bg-white p-3 rounded-lg shadow-md flex flex-col items-center justify-center ragdoll" draggable="true">
|
| 68 |
+
<i data-feather="box" class="text-yellow-600 w-8 h-8"></i>
|
| 69 |
+
<span class="text-xs mt-1">Basket</span>
|
| 70 |
+
</div>
|
| 71 |
+
<div class="food-item bg-white p-3 rounded-lg shadow-md flex flex-col items-center justify-center ragdoll" draggable="true">
|
| 72 |
+
<i data-feather="glass" class="text-blue-400 w-8 h-8"></i>
|
| 73 |
+
<span class="text-xs mt-1">Glass</span>
|
| 74 |
+
</div>
|
| 75 |
+
<div class="food-item bg-white p-3 rounded-lg shadow-md flex flex-col items-center justify-center ragdoll" draggable="true">
|
| 76 |
+
<i data-feather="wine" class="text-purple-600 w-8 h-8"></i>
|
| 77 |
+
<span class="text-xs mt-1">Bottle</span>
|
| 78 |
+
</div>
|
| 79 |
+
<div class="food-item bg-white p-3 rounded-lg shadow-md flex flex-col items-center justify-center ragdoll" draggable="true">
|
| 80 |
+
<i data-feather="utensils" class="text-gray-700 w-8 h-8"></i>
|
| 81 |
+
<span class="text-xs mt-1">Utensils</span>
|
| 82 |
+
</div>
|
| 83 |
+
</div>
|
| 84 |
+
</div>
|
| 85 |
+
|
| 86 |
+
<div class="bg-amber-100 rounded-2xl p-6 relative">
|
| 87 |
+
<h2 class="text-2xl font-semibold text-amber-800 mb-4">Picnic Blanket</h2>
|
| 88 |
+
<div id="picnicBlanket" class="bg-white bg-opacity-70 border-2 border-dashed border-amber-400 rounded-xl h-64 flex items-center justify-center">
|
| 89 |
+
<p class="text-amber-600 text-center">Drag items here to set up your perfect date picnic!</p>
|
| 90 |
+
</div>
|
| 91 |
+
<div class="absolute bottom-4 right-4">
|
| 92 |
+
<button id="startDateBtn" class="bg-pink-500 hover:bg-pink-600 text-white px-6 py-2 rounded-full shadow-lg transform transition hover:scale-105">
|
| 93 |
+
<i data-feather="heart" class="inline mr-2"></i> Start Date
|
| 94 |
+
</button>
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
|
| 99 |
+
<div class="mt-8 bg-red-100 rounded-2xl p-6">
|
| 100 |
+
<h2 class="text-2xl font-semibold text-red-800 mb-4">Animal Intruders</h2>
|
| 101 |
+
<div class="flex flex-wrap gap-4">
|
| 102 |
+
<div class="animal bg-white p-3 rounded-lg shadow-md flex flex-col items-center justify-center ragdoll" draggable="true">
|
| 103 |
+
<i data-feather="github" class="text-gray-800 w-8 h-8"></i>
|
| 104 |
+
<span class="text-xs mt-1">Squirrel</span>
|
| 105 |
+
</div>
|
| 106 |
+
<div class="animal bg-white p-3 rounded-lg shadow-md flex flex-col items-center justify-center ragdoll" draggable="true">
|
| 107 |
+
<i data-feather="twitter" class="text-blue-400 w-8 h-8"></i>
|
| 108 |
+
<span class="text-xs mt-1">Bird</span>
|
| 109 |
+
</div>
|
| 110 |
+
<div class="animal bg-white p-3 rounded-lg shadow-md flex flex-col items-center justify-center ragdoll" draggable="true">
|
| 111 |
+
<i data-feather="codesandbox" class="text-amber-700 w-8 h-8"></i>
|
| 112 |
+
<span class="text-xs mt-1">Raccoon</span>
|
| 113 |
+
</div>
|
| 114 |
+
<div class="animal bg-white p-3 rounded-lg shadow-md flex flex-col items-center justify-center ragdoll" draggable="true">
|
| 115 |
+
<i data-feather="cpu" class="text-gray-600 w-8 h-8"></i>
|
| 116 |
+
<span class="text-xs mt-1">Dog</span>
|
| 117 |
+
</div>
|
| 118 |
+
</div>
|
| 119 |
+
<p class="mt-4 text-red-700">Drag and throw them away from your picnic!</p>
|
| 120 |
+
</div>
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
|
| 124 |
+
<script>
|
| 125 |
+
// Initialize Vanta.js background
|
| 126 |
+
VANTA.GLOBE({
|
| 127 |
+
el: "#gameCanvas",
|
| 128 |
+
mouseControls: true,
|
| 129 |
+
touchControls: true,
|
| 130 |
+
gyroControls: false,
|
| 131 |
+
minHeight: 200.00,
|
| 132 |
+
minWidth: 200.00,
|
| 133 |
+
scale: 1.00,
|
| 134 |
+
scaleMobile: 1.00,
|
| 135 |
+
color: 0x3a5a40,
|
| 136 |
+
backgroundColor: 0xe9ecef
|
| 137 |
+
});
|
| 138 |
+
|
| 139 |
+
// Initialize feather icons
|
| 140 |
+
feather.replace();
|
| 141 |
+
|
| 142 |
+
// Game state
|
| 143 |
+
let gameTime = 180; // 3 minutes in seconds
|
| 144 |
+
let dateMeter = 100;
|
| 145 |
+
let gameActive = false;
|
| 146 |
+
let itemsPlaced = 0;
|
| 147 |
+
const totalItems = 6;
|
| 148 |
+
|
| 149 |
+
// Timer function
|
| 150 |
+
function updateTimer() {
|
| 151 |
+
if (!gameActive) return;
|
| 152 |
+
|
| 153 |
+
gameTime--;
|
| 154 |
+
const minutes = Math.floor(gameTime / 60);
|
| 155 |
+
const seconds = gameTime % 60;
|
| 156 |
+
document.getElementById('timer').textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
|
| 157 |
+
|
| 158 |
+
if (gameTime <= 0) {
|
| 159 |
+
endGame();
|
| 160 |
+
} else {
|
| 161 |
+
setTimeout(updateTimer, 1000);
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
// Date meter function
|
| 166 |
+
function updateDateMeter(change) {
|
| 167 |
+
dateMeter = Math.max(0, Math.min(100, dateMeter + change));
|
| 168 |
+
const hearts = Math.ceil(dateMeter / 20);
|
| 169 |
+
document.getElementById('dateMeter').textContent = '❤️'.repeat(hearts) + ` ${dateMeter}%`;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
// Start game function
|
| 173 |
+
function startGame() {
|
| 174 |
+
gameActive = true;
|
| 175 |
+
gameTime = 180;
|
| 176 |
+
dateMeter = 100;
|
| 177 |
+
itemsPlaced = 0;
|
| 178 |
+
updateTimer();
|
| 179 |
+
document.getElementById('startDateBtn').textContent = "Date in Progress!";
|
| 180 |
+
document.getElementById('startDateBtn').classList.remove('bg-pink-500', 'hover:bg-pink-600');
|
| 181 |
+
document.getElementById('startDateBtn').classList.add('bg-purple-500', 'hover:bg-purple-600');
|
| 182 |
+
|
| 183 |
+
// Start animal intrusions
|
| 184 |
+
startAnimalIntrusions();
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
// End game function
|
| 188 |
+
function endGame() {
|
| 189 |
+
gameActive = false;
|
| 190 |
+
clearInterval(animalInterval);
|
| 191 |
+
let message;
|
| 192 |
+
|
| 193 |
+
if (dateMeter >= 80) {
|
| 194 |
+
message = "Perfect Date! ❤️";
|
| 195 |
+
} else if (dateMeter >= 50) {
|
| 196 |
+
message = "Nice Try! 😊";
|
| 197 |
+
} else {
|
| 198 |
+
message = "Better Luck Next Time! 😅";
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
alert(`Game Over!\n${message}\nFinal Date Meter: ${dateMeter}%`);
|
| 202 |
+
document.getElementById('startDateBtn').innerHTML = '<i data-feather="heart" class="inline mr-2"></i> Try Again';
|
| 203 |
+
document.getElementById('startDateBtn').classList.remove('bg-purple-500', 'hover:bg-purple-600');
|
| 204 |
+
document.getElementById('startDateBtn').classList.add('bg-pink-500', 'hover:bg-pink-600');
|
| 205 |
+
feather.replace();
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
// Animal intrusion function
|
| 209 |
+
let animalInterval;
|
| 210 |
+
function startAnimalIntrusions() {
|
| 211 |
+
animalInterval = setInterval(() => {
|
| 212 |
+
if (!gameActive) return;
|
| 213 |
+
|
| 214 |
+
// Random chance to decrease date meter
|
| 215 |
+
if (Math.random() < 0.3) {
|
| 216 |
+
updateDateMeter(-5);
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
// Add random animal to picnic
|
| 220 |
+
const animals = document.querySelectorAll('.animal');
|
| 221 |
+
const randomAnimal = animals[Math.floor(Math.random() * animals.length)].cloneNode(true);
|
| 222 |
+
const blanket = document.getElementById('picnicBlanket');
|
| 223 |
+
|
| 224 |
+
randomAnimal.style.position = 'absolute';
|
| 225 |
+
randomAnimal.style.left = `${Math.random() * 80 + 10}%`;
|
| 226 |
+
randomAnimal.style.top = `${Math.random() * 80 + 10}%`;
|
| 227 |
+
randomAnimal.classList.add('animate-bounce');
|
| 228 |
+
|
| 229 |
+
blanket.appendChild(randomAnimal);
|
| 230 |
+
feather.replace();
|
| 231 |
+
|
| 232 |
+
// Remove animal after some time
|
| 233 |
+
setTimeout(() => {
|
| 234 |
+
if (randomAnimal.parentNode) {
|
| 235 |
+
randomAnimal.remove();
|
| 236 |
+
updateDateMeter(2); // Small bonus for animal leaving
|
| 237 |
+
}
|
| 238 |
+
}, 3000);
|
| 239 |
+
|
| 240 |
+
}, 2000);
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
// Drag and drop functionality
|
| 244 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 245 |
+
const foodItems = document.querySelectorAll('.food-item');
|
| 246 |
+
const blanket = document.getElementById('picnicBlanket');
|
| 247 |
+
const startBtn = document.getElementById('startDateBtn');
|
| 248 |
+
|
| 249 |
+
// Setup drag for food items
|
| 250 |
+
foodItems.forEach(item => {
|
| 251 |
+
item.addEventListener('dragstart', (e) => {
|
| 252 |
+
e.dataTransfer.setData('text/plain', item.innerHTML);
|
| 253 |
+
e.dataTransfer.effectAllowed = 'copy';
|
| 254 |
+
});
|
| 255 |
+
});
|
| 256 |
+
|
| 257 |
+
// Setup drop for picnic blanket
|
| 258 |
+
blanket.addEventListener('dragover', (e) => {
|
| 259 |
+
e.preventDefault();
|
| 260 |
+
e.dataTransfer.dropEffect = 'copy';
|
| 261 |
+
blanket.classList.add('bg-amber-50');
|
| 262 |
+
});
|
| 263 |
+
|
| 264 |
+
blanket.addEventListener('dragleave', () => {
|
| 265 |
+
blanket.classList.remove('bg-amber-50');
|
| 266 |
+
});
|
| 267 |
+
|
| 268 |
+
blanket.addEventListener('drop', (e) => {
|
| 269 |
+
e.preventDefault();
|
| 270 |
+
blanket.classList.remove('bg-amber-50');
|
| 271 |
+
|
| 272 |
+
if (!gameActive && e.dataTransfer.getData('text/plain')) {
|
| 273 |
+
const data = e.dataTransfer.getData('text/plain');
|
| 274 |
+
const newItem = document.createElement('div');
|
| 275 |
+
newItem.className = 'food-item bg-white p-3 rounded-lg shadow-md absolute flex flex-col items-center justify-center';
|
| 276 |
+
newItem.innerHTML = data;
|
| 277 |
+
newItem.style.left = `${e.offsetX - 25}px`;
|
| 278 |
+
newItem.style.top = `${e.offsetY - 25}px`;
|
| 279 |
+
newItem.draggable = true;
|
| 280 |
+
|
| 281 |
+
// Make placed items draggable within blanket
|
| 282 |
+
newItem.addEventListener('dragstart', (ev) => {
|
| 283 |
+
ev.dataTransfer.setData('text/plain', newItem.innerHTML);
|
| 284 |
+
ev.dataTransfer.effectAllowed = 'move';
|
| 285 |
+
});
|
| 286 |
+
|
| 287 |
+
blanket.appendChild(newItem);
|
| 288 |
+
feather.replace();
|
| 289 |
+
|
| 290 |
+
// Count placed items
|
| 291 |
+
itemsPlaced++;
|
| 292 |
+
if (itemsPlaced >= totalItems) {
|
| 293 |
+
startBtn.disabled = false;
|
| 294 |
+
}
|
| 295 |
+
}
|
| 296 |
+
});
|
| 297 |
+
|
| 298 |
+
// Start date button
|
| 299 |
+
startBtn.addEventListener('click', () => {
|
| 300 |
+
if (!gameActive && itemsPlaced >= totalItems) {
|
| 301 |
+
startGame();
|
| 302 |
+
} else if (!gameActive) {
|
| 303 |
+
alert('Please set up your picnic with all items first!');
|
| 304 |
+
}
|
| 305 |
+
});
|
| 306 |
+
|
| 307 |
+
// Setup animal throwing
|
| 308 |
+
document.addEventListener('dragover', (e) => {
|
| 309 |
+
if (e.target.classList.contains('animal')) {
|
| 310 |
+
e.preventDefault();
|
| 311 |
+
e.dataTransfer.dropEffect = 'move';
|
| 312 |
+
}
|
| 313 |
+
});
|
| 314 |
+
|
| 315 |
+
document.addEventListener('drop', (e) => {
|
| 316 |
+
if (e.target.classList.contains('animal')) {
|
| 317 |
+
e.preventDefault();
|
| 318 |
+
const animal = e.target;
|
| 319 |
+
animal.style.transform = `translate(${Math.random() * 200 - 100}px, ${Math.random() * 200 - 100}px) rotate(${Math.random() * 360}deg)`;
|
| 320 |
+
setTimeout(() => {
|
| 321 |
+
animal.remove();
|
| 322 |
+
if (gameActive) {
|
| 323 |
+
updateDateMeter(5); // Bonus for throwing animal
|
| 324 |
+
}
|
| 325 |
+
}, 500);
|
| 326 |
+
}
|
| 327 |
+
});
|
| 328 |
+
});
|
| 329 |
+
</script>
|
| 330 |
+
</body>
|
| 331 |
</html>
|