Spaces:
Running
Running
Add 3 files
Browse files- README.md +7 -5
- index.html +632 -19
- prompts.txt +2 -0
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: e-ik-at-sim-lat-r
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: green
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
@@ -1,19 +1,632 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 |
+
<!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>Advanced Projectile Simulator</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
9 |
+
<style>
|
10 |
+
#gameCanvas {
|
11 |
+
background-color: #e2e8f0;
|
12 |
+
border-radius: 0.5rem;
|
13 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
14 |
+
background-image: linear-gradient(to bottom, #e2e8f0, #f0f4f9);
|
15 |
+
}
|
16 |
+
|
17 |
+
.slider::-webkit-slider-thumb {
|
18 |
+
-webkit-appearance: none;
|
19 |
+
appearance: none;
|
20 |
+
width: 22px;
|
21 |
+
height: 22px;
|
22 |
+
border-radius: 50%;
|
23 |
+
background: #3b82f6;
|
24 |
+
cursor: pointer;
|
25 |
+
box-shadow: 0 0 5px rgba(0,0,0,0.3);
|
26 |
+
transition: transform 0.2s;
|
27 |
+
}
|
28 |
+
|
29 |
+
.slider::-webkit-slider-thumb:hover {
|
30 |
+
transform: scale(1.1);
|
31 |
+
}
|
32 |
+
|
33 |
+
.slider::-moz-range-thumb {
|
34 |
+
width: 22px;
|
35 |
+
height: 22px;
|
36 |
+
border-radius: 50%;
|
37 |
+
background: #3b82f6;
|
38 |
+
cursor: pointer;
|
39 |
+
box-shadow: 0 0 5px rgba(0,0,0,0.3);
|
40 |
+
}
|
41 |
+
|
42 |
+
.target {
|
43 |
+
transition: transform 0.3s ease;
|
44 |
+
}
|
45 |
+
|
46 |
+
.target:hover {
|
47 |
+
transform: scale(1.1);
|
48 |
+
}
|
49 |
+
|
50 |
+
.explosion {
|
51 |
+
position: absolute;
|
52 |
+
width: 60px;
|
53 |
+
height: 60px;
|
54 |
+
background-image: radial-gradient(circle, #ff0000 0%, #ff6600 50%, transparent 70%);
|
55 |
+
border-radius: 50%;
|
56 |
+
animation: explode 0.6s ease-out forwards;
|
57 |
+
pointer-events: none;
|
58 |
+
filter: drop-shadow(0 0 10px rgba(255,100,0,0.7));
|
59 |
+
}
|
60 |
+
|
61 |
+
@keyframes explode {
|
62 |
+
0% { transform: scale(0); opacity: 1; }
|
63 |
+
50% { transform: scale(2); opacity: 0.8; }
|
64 |
+
100% { transform: scale(4); opacity: 0; }
|
65 |
+
}
|
66 |
+
|
67 |
+
.power-meter {
|
68 |
+
height: 6px;
|
69 |
+
background: linear-gradient(to right, #4ade80, #f59e0b, #ef4444);
|
70 |
+
border-radius: 3px;
|
71 |
+
margin-top: 4px;
|
72 |
+
}
|
73 |
+
|
74 |
+
#fireBtn {
|
75 |
+
background: linear-gradient(to right, #3b82f6, #6366f1);
|
76 |
+
box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
|
77 |
+
}
|
78 |
+
|
79 |
+
#fireBtn:hover {
|
80 |
+
background: linear-gradient(to right, #2563eb, #4f46e5);
|
81 |
+
transform: translateY(-2px);
|
82 |
+
box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
|
83 |
+
}
|
84 |
+
|
85 |
+
.cannon-flash {
|
86 |
+
position: absolute;
|
87 |
+
width: 40px;
|
88 |
+
height: 20px;
|
89 |
+
background: radial-gradient(circle, #f59e0b 0%, #ef4444 70%, transparent 100%);
|
90 |
+
border-radius: 50%;
|
91 |
+
animation: flash 0.3s ease-out;
|
92 |
+
pointer-events: none;
|
93 |
+
}
|
94 |
+
|
95 |
+
@keyframes flash {
|
96 |
+
0% { transform: scale(0.5); opacity: 1; }
|
97 |
+
100% { transform: scale(2); opacity: 0; }
|
98 |
+
}
|
99 |
+
</style>
|
100 |
+
</head>
|
101 |
+
<body class="bg-gray-100 min-h-screen flex flex-col items-center py-8 px-4">
|
102 |
+
<div class="w-full max-w-4xl">
|
103 |
+
<h1 class="text-3xl md:text-4xl font-bold text-center text-blue-600 mb-2">Advanced Projectile Simulator</h1>
|
104 |
+
<p class="text-center text-gray-600 mb-6">Adjust the angle and power, then fire to hit the moving target!</p>
|
105 |
+
|
106 |
+
<div class="flex flex-col lg:flex-row gap-6">
|
107 |
+
<div class="flex-1">
|
108 |
+
<div class="relative">
|
109 |
+
<canvas id="gameCanvas" width="600" height="400" class="w-full h-auto border border-gray-300"></canvas>
|
110 |
+
<div id="explosionContainer" class="absolute top-0 left-0 w-full h-full pointer-events-none"></div>
|
111 |
+
</div>
|
112 |
+
|
113 |
+
<div class="mt-4 flex justify-center">
|
114 |
+
<button id="fireBtn" class="text-white font-bold py-3 px-8 rounded-full transition duration-300 flex items-center gap-2">
|
115 |
+
<i class="fas fa-bolt"></i> FIRE PROJECTILE!
|
116 |
+
</button>
|
117 |
+
</div>
|
118 |
+
</div>
|
119 |
+
|
120 |
+
<div class="w-full lg:w-72 bg-white p-6 rounded-lg shadow-lg">
|
121 |
+
<div class="mb-6">
|
122 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Launch Controls</h2>
|
123 |
+
|
124 |
+
<div class="mb-4">
|
125 |
+
<label for="angleSlider" class="block text-sm font-medium text-gray-700 mb-1">Launch Angle: <span id="angleValue">45</span>°</label>
|
126 |
+
<input type="range" id="angleSlider" min="0" max="90" value="45" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer slider">
|
127 |
+
</div>
|
128 |
+
|
129 |
+
<div class="mb-4">
|
130 |
+
<label for="powerSlider" class="block text-sm font-medium text-gray-700 mb-1">Launch Power: <span id="powerValue">70</span>%</label>
|
131 |
+
<input type="range" id="powerSlider" min="10" max="200" value="70" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer slider">
|
132 |
+
<div class="power-meter">
|
133 |
+
<div id="powerMeterFill" class="h-full bg-blue-500 rounded-l-full" style="width: 35%"></div>
|
134 |
+
</div>
|
135 |
+
</div>
|
136 |
+
|
137 |
+
<div class="mb-4">
|
138 |
+
<label for="gravitySlider" class="block text-sm font-medium text-gray-700 mb-1">Gravity: <span id="gravityValue">9.8</span> m/s²</label>
|
139 |
+
<input type="range" id="gravitySlider" min="1" max="20" step="0.1" value="9.8" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer slider">
|
140 |
+
</div>
|
141 |
+
|
142 |
+
<div class="mb-4">
|
143 |
+
<label for="windSlider" class="block text-sm font-medium text-gray-700 mb-1">Wind: <span id="windValue">0</span> m/s</label>
|
144 |
+
<input type="range" id="windSlider" min="-20" max="20" value="0" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer slider">
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
|
148 |
+
<div class="mb-6">
|
149 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Mission Stats</h2>
|
150 |
+
<div class="grid grid-cols-2 gap-4">
|
151 |
+
<div class="bg-blue-50 p-3 rounded-lg border border-blue-100">
|
152 |
+
<p class="text-xs text-blue-600 font-medium">SHOTS FIRED</p>
|
153 |
+
<p id="shotsFired" class="text-2xl font-bold text-blue-800">0</p>
|
154 |
+
</div>
|
155 |
+
<div class="bg-green-50 p-3 rounded-lg border border-green-100">
|
156 |
+
<p class="text-xs text-green-600 font-medium">TARGETS HIT</p>
|
157 |
+
<p id="targetsHit" class="text-2xl font-bold text-green-800">0</p>
|
158 |
+
</div>
|
159 |
+
<div class="bg-purple-50 p-3 rounded-lg border border-purple-100">
|
160 |
+
<p class="text-xs text-purple-600 font-medium">ACCURACY</p>
|
161 |
+
<p id="accuracy" class="text-2xl font-bold text-purple-800">0%</p>
|
162 |
+
</div>
|
163 |
+
<div class="bg-yellow-50 p-3 rounded-lg border border-yellow-100">
|
164 |
+
<p class="text-xs text-yellow-600 font-medium">HIGH SCORE</p>
|
165 |
+
<p id="highScore" class="text-2xl font-bold text-yellow-800">0</p>
|
166 |
+
</div>
|
167 |
+
</div>
|
168 |
+
</div>
|
169 |
+
|
170 |
+
<button id="resetBtn" class="w-full bg-gray-100 hover:bg-gray-200 text-gray-800 font-medium py-2 px-4 rounded-lg transition duration-300 flex items-center justify-center gap-2 border border-gray-200">
|
171 |
+
<i class="fas fa-sync-alt"></i> Reset Simulation
|
172 |
+
</button>
|
173 |
+
</div>
|
174 |
+
</div>
|
175 |
+
|
176 |
+
<div class="mt-8 bg-white p-6 rounded-lg shadow-lg">
|
177 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Advanced Controls</h2>
|
178 |
+
<ul class="space-y-2 text-gray-700">
|
179 |
+
<li class="flex items-start gap-2"><i class="fas fa-bolt text-yellow-500 mt-1"></i> <span>Power range increased to 10-200% for stronger launches</span></li>
|
180 |
+
<li class="flex items-start gap-2"><i class="fas fa-wind text-blue-400 mt-1"></i> <span>Added wind control (-20 to +20 m/s) to affect projectile path</span></li>
|
181 |
+
<li class="flex items-start gap-2"><i class="fas fa-bullseye text-red-500 mt-1"></i> <span>Moving target that changes position after each shot</span></li>
|
182 |
+
<li class="flex items-start gap-2"><i class="fas fa-tachometer-alt text-green-500 mt-1"></i> <span>Visual power meter shows launch strength</span></li>
|
183 |
+
<li class="flex items-start gap-2"><i class="fas fa-fire text-orange-500 mt-1"></i> <span>Enhanced explosion effects with better visuals</span></li>
|
184 |
+
</ul>
|
185 |
+
</div>
|
186 |
+
</div>
|
187 |
+
|
188 |
+
<script>
|
189 |
+
document.addEventListener('DOMContentLoaded', function() {
|
190 |
+
// Game elements
|
191 |
+
const canvas = document.getElementById('gameCanvas');
|
192 |
+
const ctx = canvas.getContext('2d');
|
193 |
+
const explosionContainer = document.getElementById('explosionContainer');
|
194 |
+
|
195 |
+
// Controls
|
196 |
+
const angleSlider = document.getElementById('angleSlider');
|
197 |
+
const powerSlider = document.getElementById('powerSlider');
|
198 |
+
const gravitySlider = document.getElementById('gravitySlider');
|
199 |
+
const windSlider = document.getElementById('windSlider');
|
200 |
+
const angleValue = document.getElementById('angleValue');
|
201 |
+
const powerValue = document.getElementById('powerValue');
|
202 |
+
const gravityValue = document.getElementById('gravityValue');
|
203 |
+
const windValue = document.getElementById('windValue');
|
204 |
+
const fireBtn = document.getElementById('fireBtn');
|
205 |
+
const resetBtn = document.getElementById('resetBtn');
|
206 |
+
const powerMeterFill = document.getElementById('powerMeterFill');
|
207 |
+
|
208 |
+
// Stats
|
209 |
+
const shotsFiredEl = document.getElementById('shotsFired');
|
210 |
+
const targetsHitEl = document.getElementById('targetsHit');
|
211 |
+
const accuracyEl = document.getElementById('accuracy');
|
212 |
+
const highScoreEl = document.getElementById('highScore');
|
213 |
+
|
214 |
+
// Game variables
|
215 |
+
let shotsFired = 0;
|
216 |
+
let targetsHit = 0;
|
217 |
+
let highScore = localStorage.getItem('projectileHighScore') || 0;
|
218 |
+
let isFiring = false;
|
219 |
+
let animationId = null;
|
220 |
+
let targetMoving = false;
|
221 |
+
let targetMoveDirection = 1;
|
222 |
+
let targetMoveSpeed = 1;
|
223 |
+
|
224 |
+
// Set initial stats
|
225 |
+
highScoreEl.textContent = highScore;
|
226 |
+
updateStats();
|
227 |
+
|
228 |
+
// Projectile variables
|
229 |
+
let projectile = {
|
230 |
+
x: 50,
|
231 |
+
y: canvas.height - 50,
|
232 |
+
radius: 10,
|
233 |
+
color: '#3b82f6',
|
234 |
+
velocityX: 0,
|
235 |
+
velocityY: 0,
|
236 |
+
gravity: 9.8,
|
237 |
+
wind: 0,
|
238 |
+
time: 0,
|
239 |
+
trail: []
|
240 |
+
};
|
241 |
+
|
242 |
+
// Target variables
|
243 |
+
let target = {
|
244 |
+
x: Math.random() * (canvas.width - 100) + 100,
|
245 |
+
y: Math.random() * (canvas.height - 150) + 50,
|
246 |
+
radius: 25,
|
247 |
+
color: '#ef4444',
|
248 |
+
moving: true
|
249 |
+
};
|
250 |
+
|
251 |
+
// Update control values display
|
252 |
+
angleSlider.addEventListener('input', () => angleValue.textContent = angleSlider.value);
|
253 |
+
powerSlider.addEventListener('input', updatePowerDisplay);
|
254 |
+
gravitySlider.addEventListener('input', () => gravityValue.textContent = gravitySlider.value);
|
255 |
+
windSlider.addEventListener('input', () => windValue.textContent = windSlider.value);
|
256 |
+
|
257 |
+
function updatePowerDisplay() {
|
258 |
+
powerValue.textContent = powerSlider.value;
|
259 |
+
const percentage = (powerSlider.value - powerSlider.min) / (powerSlider.max - powerSlider.min) * 100;
|
260 |
+
powerMeterFill.style.width = `${percentage}%`;
|
261 |
+
|
262 |
+
// Update color based on power level
|
263 |
+
if (powerSlider.value < 70) {
|
264 |
+
powerMeterFill.style.background = '#4ade80'; // Green
|
265 |
+
} else if (powerSlider.value < 140) {
|
266 |
+
powerMeterFill.style.background = '#f59e0b'; // Orange
|
267 |
+
} else {
|
268 |
+
powerMeterFill.style.background = '#ef4444'; // Red
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
// Initialize power display
|
273 |
+
updatePowerDisplay();
|
274 |
+
|
275 |
+
// Draw game elements
|
276 |
+
function draw() {
|
277 |
+
// Clear canvas
|
278 |
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
279 |
+
|
280 |
+
// Draw sky gradient
|
281 |
+
const skyGradient = ctx.createLinearGradient(0, 0, 0, canvas.height);
|
282 |
+
skyGradient.addColorStop(0, '#e0f2fe');
|
283 |
+
skyGradient.addColorStop(1, '#bae6fd');
|
284 |
+
ctx.fillStyle = skyGradient;
|
285 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height - 20);
|
286 |
+
|
287 |
+
// Draw ground
|
288 |
+
const groundGradient = ctx.createLinearGradient(0, canvas.height - 20, 0, canvas.height);
|
289 |
+
groundGradient.addColorStop(0, '#a3a3a3');
|
290 |
+
groundGradient.addColorStop(1, '#737373');
|
291 |
+
ctx.fillStyle = groundGradient;
|
292 |
+
ctx.fillRect(0, canvas.height - 20, canvas.width, 20);
|
293 |
+
|
294 |
+
// Draw cannon
|
295 |
+
ctx.fillStyle = '#4b5563';
|
296 |
+
ctx.fillRect(30, canvas.height - 50, 40, 30);
|
297 |
+
|
298 |
+
// Draw cannon barrel
|
299 |
+
const angleRad = (angleSlider.value * Math.PI) / 180;
|
300 |
+
const barrelLength = 40;
|
301 |
+
ctx.save();
|
302 |
+
ctx.translate(50, canvas.height - 50);
|
303 |
+
ctx.rotate(-angleRad);
|
304 |
+
|
305 |
+
// Barrel gradient
|
306 |
+
const barrelGradient = ctx.createLinearGradient(0, -5, barrelLength, 10);
|
307 |
+
barrelGradient.addColorStop(0, '#6b7280');
|
308 |
+
barrelGradient.addColorStop(1, '#4b5563');
|
309 |
+
ctx.fillStyle = barrelGradient;
|
310 |
+
ctx.fillRect(0, -5, barrelLength, 10);
|
311 |
+
|
312 |
+
// Barrel details
|
313 |
+
ctx.strokeStyle = '#9ca3af';
|
314 |
+
ctx.lineWidth = 1;
|
315 |
+
ctx.strokeRect(0, -5, barrelLength, 10);
|
316 |
+
|
317 |
+
ctx.restore();
|
318 |
+
|
319 |
+
// Draw projectile if not firing
|
320 |
+
if (!isFiring) {
|
321 |
+
// Projectile gradient
|
322 |
+
const projectileGradient = ctx.createRadialGradient(
|
323 |
+
projectile.x - 3, projectile.y - 3, 2,
|
324 |
+
projectile.x, projectile.y, projectile.radius
|
325 |
+
);
|
326 |
+
projectileGradient.addColorStop(0, '#93c5fd');
|
327 |
+
projectileGradient.addColorStop(1, '#1d4ed8');
|
328 |
+
|
329 |
+
ctx.beginPath();
|
330 |
+
ctx.arc(projectile.x, projectile.y, projectile.radius, 0, Math.PI * 2);
|
331 |
+
ctx.fillStyle = projectileGradient;
|
332 |
+
ctx.fill();
|
333 |
+
|
334 |
+
// Projectile shine
|
335 |
+
ctx.beginPath();
|
336 |
+
ctx.arc(projectile.x - 3, projectile.y - 3, 3, 0, Math.PI * 2);
|
337 |
+
ctx.fillStyle = 'rgba(255, 255, 255, 0.7)';
|
338 |
+
ctx.fill();
|
339 |
+
ctx.closePath();
|
340 |
+
}
|
341 |
+
|
342 |
+
// Move target if enabled
|
343 |
+
if (target.moving) {
|
344 |
+
target.x += targetMoveSpeed * targetMoveDirection;
|
345 |
+
|
346 |
+
// Reverse direction at edges
|
347 |
+
if (target.x - target.radius < 100 || target.x + target.radius > canvas.width - 20) {
|
348 |
+
targetMoveDirection *= -1;
|
349 |
+
}
|
350 |
+
}
|
351 |
+
|
352 |
+
// Draw target
|
353 |
+
const targetGradient = ctx.createRadialGradient(
|
354 |
+
target.x, target.y, target.radius * 0.3,
|
355 |
+
target.x, target.y, target.radius
|
356 |
+
);
|
357 |
+
targetGradient.addColorStop(0, '#ef4444');
|
358 |
+
targetGradient.addColorStop(1, '#b91c1c');
|
359 |
+
|
360 |
+
ctx.beginPath();
|
361 |
+
ctx.arc(target.x, target.y, target.radius, 0, Math.PI * 2);
|
362 |
+
ctx.fillStyle = targetGradient;
|
363 |
+
ctx.fill();
|
364 |
+
ctx.closePath();
|
365 |
+
|
366 |
+
// Draw target rings
|
367 |
+
ctx.beginPath();
|
368 |
+
ctx.arc(target.x, target.y, target.radius * 0.66, 0, Math.PI * 2);
|
369 |
+
ctx.strokeStyle = 'rgba(255, 255, 255, 0.8)';
|
370 |
+
ctx.lineWidth = 3;
|
371 |
+
ctx.stroke();
|
372 |
+
ctx.closePath();
|
373 |
+
|
374 |
+
ctx.beginPath();
|
375 |
+
ctx.arc(target.x, target.y, target.radius * 0.33, 0, Math.PI * 2);
|
376 |
+
ctx.strokeStyle = 'rgba(255, 255, 255, 0.8)';
|
377 |
+
ctx.lineWidth = 3;
|
378 |
+
ctx.stroke();
|
379 |
+
ctx.closePath();
|
380 |
+
|
381 |
+
// Draw bullseye
|
382 |
+
ctx.beginPath();
|
383 |
+
ctx.arc(target.x, target.y, target.radius * 0.15, 0, Math.PI * 2);
|
384 |
+
ctx.fillStyle = 'rgba(255, 255, 255, 0.9)';
|
385 |
+
ctx.fill();
|
386 |
+
ctx.closePath();
|
387 |
+
}
|
388 |
+
|
389 |
+
// Fire projectile
|
390 |
+
fireBtn.addEventListener('click', fireProjectile);
|
391 |
+
|
392 |
+
function fireProjectile() {
|
393 |
+
if (isFiring) return;
|
394 |
+
|
395 |
+
isFiring = true;
|
396 |
+
shotsFired++;
|
397 |
+
updateStats();
|
398 |
+
|
399 |
+
const angle = (angleSlider.value * Math.PI) / 180;
|
400 |
+
const power = powerSlider.value * 0.8; // Increased power multiplier
|
401 |
+
projectile.gravity = parseFloat(gravitySlider.value);
|
402 |
+
projectile.wind = parseFloat(windSlider.value) * 0.1;
|
403 |
+
|
404 |
+
projectile.velocityX = power * Math.cos(angle) + projectile.wind;
|
405 |
+
projectile.velocityY = power * Math.sin(angle);
|
406 |
+
projectile.time = 0;
|
407 |
+
projectile.trail = [];
|
408 |
+
|
409 |
+
// Reset projectile position
|
410 |
+
projectile.x = 50;
|
411 |
+
projectile.y = canvas.height - 50;
|
412 |
+
|
413 |
+
// Create cannon flash effect
|
414 |
+
createCannonFlash();
|
415 |
+
|
416 |
+
animateProjectile();
|
417 |
+
}
|
418 |
+
|
419 |
+
// Create cannon flash effect
|
420 |
+
function createCannonFlash() {
|
421 |
+
const angleRad = (angleSlider.value * Math.PI) / 180;
|
422 |
+
const flash = document.createElement('div');
|
423 |
+
flash.className = 'cannon-flash';
|
424 |
+
|
425 |
+
// Position flash at cannon barrel end
|
426 |
+
const barrelLength = 40;
|
427 |
+
const flashX = 50 + Math.cos(-angleRad) * barrelLength - 20;
|
428 |
+
const flashY = canvas.height - 50 + Math.sin(-angleRad) * barrelLength - 10;
|
429 |
+
|
430 |
+
flash.style.left = `${flashX}px`;
|
431 |
+
flash.style.top = `${flashY}px`;
|
432 |
+
explosionContainer.appendChild(flash);
|
433 |
+
|
434 |
+
// Remove flash after animation
|
435 |
+
setTimeout(() => {
|
436 |
+
flash.remove();
|
437 |
+
}, 300);
|
438 |
+
}
|
439 |
+
|
440 |
+
// Animate projectile motion
|
441 |
+
function animateProjectile() {
|
442 |
+
// Time increment (affects simulation smoothness)
|
443 |
+
const timeIncrement = 0.05;
|
444 |
+
|
445 |
+
// Update position
|
446 |
+
projectile.time += timeIncrement;
|
447 |
+
projectile.x = 50 + (projectile.velocityX * projectile.time) + (0.5 * projectile.wind * projectile.time * projectile.time);
|
448 |
+
projectile.y = canvas.height - 50 - (projectile.velocityY * projectile.time - 0.5 * projectile.gravity * projectile.time * projectile.time);
|
449 |
+
|
450 |
+
// Store position for trail
|
451 |
+
if (projectile.trail.length > 20) {
|
452 |
+
projectile.trail.shift();
|
453 |
+
}
|
454 |
+
projectile.trail.push({x: projectile.x, y: projectile.y});
|
455 |
+
|
456 |
+
// Check for collisions
|
457 |
+
if (checkCollision()) {
|
458 |
+
// Hit target
|
459 |
+
targetsHit++;
|
460 |
+
if (targetsHit > highScore) {
|
461 |
+
highScore = targetsHit;
|
462 |
+
localStorage.setItem('projectileHighScore', highScore);
|
463 |
+
highScoreEl.textContent = highScore;
|
464 |
+
}
|
465 |
+
updateStats();
|
466 |
+
createExplosion(target.x, target.y);
|
467 |
+
moveTarget();
|
468 |
+
resetProjectile();
|
469 |
+
return;
|
470 |
+
}
|
471 |
+
|
472 |
+
// Check if projectile is out of bounds
|
473 |
+
if (projectile.y > canvas.height - 20 || projectile.x > canvas.width || projectile.x < 0) {
|
474 |
+
resetProjectile();
|
475 |
+
return;
|
476 |
+
}
|
477 |
+
|
478 |
+
// Redraw
|
479 |
+
draw();
|
480 |
+
|
481 |
+
// Draw projectile with glow effect
|
482 |
+
ctx.beginPath();
|
483 |
+
ctx.arc(projectile.x, projectile.y, projectile.radius, 0, Math.PI * 2);
|
484 |
+
|
485 |
+
// Projectile gradient
|
486 |
+
const projectileGradient = ctx.createRadialGradient(
|
487 |
+
projectile.x - 3, projectile.y - 3, 2,
|
488 |
+
projectile.x, projectile.y, projectile.radius
|
489 |
+
);
|
490 |
+
projectileGradient.addColorStop(0, '#93c5fd');
|
491 |
+
projectileGradient.addColorStop(1, '#1d4ed8');
|
492 |
+
ctx.fillStyle = projectileGradient;
|
493 |
+
ctx.fill();
|
494 |
+
|
495 |
+
// Projectile glow
|
496 |
+
ctx.shadowColor = '#3b82f6';
|
497 |
+
ctx.shadowBlur = 10;
|
498 |
+
ctx.fill();
|
499 |
+
ctx.shadowBlur = 0;
|
500 |
+
|
501 |
+
// Draw trail
|
502 |
+
if (projectile.trail.length > 1) {
|
503 |
+
ctx.beginPath();
|
504 |
+
ctx.moveTo(projectile.trail[0].x, projectile.trail[0].y);
|
505 |
+
|
506 |
+
for (let i = 1; i < projectile.trail.length; i++) {
|
507 |
+
ctx.lineTo(projectile.trail[i].x, projectile.trail[i].y);
|
508 |
+
}
|
509 |
+
|
510 |
+
ctx.strokeStyle = 'rgba(59, 130, 246, 0.5)';
|
511 |
+
ctx.lineWidth = 3;
|
512 |
+
ctx.stroke();
|
513 |
+
ctx.closePath();
|
514 |
+
}
|
515 |
+
|
516 |
+
// Continue animation
|
517 |
+
animationId = requestAnimationFrame(animateProjectile);
|
518 |
+
}
|
519 |
+
|
520 |
+
// Check collision with target
|
521 |
+
function checkCollision() {
|
522 |
+
const distance = Math.sqrt(
|
523 |
+
Math.pow(projectile.x - target.x, 2) +
|
524 |
+
Math.pow(projectile.y - target.y, 2)
|
525 |
+
);
|
526 |
+
return distance < projectile.radius + target.radius;
|
527 |
+
}
|
528 |
+
|
529 |
+
// Move target to new random position
|
530 |
+
function moveTarget() {
|
531 |
+
target.x = Math.random() * (canvas.width - 150) + 100;
|
532 |
+
target.y = Math.random() * (canvas.height - 170) + 70;
|
533 |
+
|
534 |
+
// Randomize movement parameters
|
535 |
+
target.moving = Math.random() > 0.3; // 70% chance to move
|
536 |
+
targetMoveSpeed = 0.5 + Math.random() * 2; // Speed between 0.5 and 2.5
|
537 |
+
targetMoveDirection = Math.random() > 0.5 ? 1 : -1; // Random direction
|
538 |
+
}
|
539 |
+
|
540 |
+
// Reset projectile after firing
|
541 |
+
function resetProjectile() {
|
542 |
+
isFiring = false;
|
543 |
+
if (animationId) {
|
544 |
+
cancelAnimationFrame(animationId);
|
545 |
+
}
|
546 |
+
draw();
|
547 |
+
}
|
548 |
+
|
549 |
+
// Create explosion effect
|
550 |
+
function createExplosion(x, y) {
|
551 |
+
const explosion = document.createElement('div');
|
552 |
+
explosion.className = 'explosion';
|
553 |
+
explosion.style.left = `${x - 30}px`;
|
554 |
+
explosion.style.top = `${y - 30}px`;
|
555 |
+
explosionContainer.appendChild(explosion);
|
556 |
+
|
557 |
+
// Add particle effects
|
558 |
+
for (let i = 0; i < 10; i++) {
|
559 |
+
setTimeout(() => {
|
560 |
+
const particle = document.createElement('div');
|
561 |
+
particle.className = 'explosion-particle';
|
562 |
+
particle.style.left = `${x - 5 + Math.random() * 10}px`;
|
563 |
+
particle.style.top = `${y - 5 + Math.random() * 10}px`;
|
564 |
+
particle.style.width = `${5 + Math.random() * 10}px`;
|
565 |
+
particle.style.height = particle.style.width;
|
566 |
+
particle.style.background = `radial-gradient(circle, ${getRandomFireColor()} 0%, transparent 70%)`;
|
567 |
+
particle.style.animation = `particle-fly ${0.5 + Math.random()}s ease-out forwards`;
|
568 |
+
explosionContainer.appendChild(particle);
|
569 |
+
|
570 |
+
setTimeout(() => {
|
571 |
+
particle.remove();
|
572 |
+
}, 1000);
|
573 |
+
}, i * 50);
|
574 |
+
}
|
575 |
+
|
576 |
+
// Remove explosion after animation
|
577 |
+
setTimeout(() => {
|
578 |
+
explosion.remove();
|
579 |
+
}, 600);
|
580 |
+
}
|
581 |
+
|
582 |
+
function getRandomFireColor() {
|
583 |
+
const colors = ['#ff0000', '#ff6600', '#ffcc00', '#ffff00'];
|
584 |
+
return colors[Math.floor(Math.random() * colors.length)];
|
585 |
+
}
|
586 |
+
|
587 |
+
// Update game stats
|
588 |
+
function updateStats() {
|
589 |
+
shotsFiredEl.textContent = shotsFired;
|
590 |
+
targetsHitEl.textContent = targetsHit;
|
591 |
+
|
592 |
+
const accuracy = shotsFired > 0 ? Math.round((targetsHit / shotsFired) * 100) : 0;
|
593 |
+
accuracyEl.textContent = `${accuracy}%`;
|
594 |
+
}
|
595 |
+
|
596 |
+
// Reset game
|
597 |
+
resetBtn.addEventListener('click', () => {
|
598 |
+
shotsFired = 0;
|
599 |
+
targetsHit = 0;
|
600 |
+
updateStats();
|
601 |
+
resetProjectile();
|
602 |
+
moveTarget();
|
603 |
+
});
|
604 |
+
|
605 |
+
// Initial draw
|
606 |
+
draw();
|
607 |
+
|
608 |
+
// Add CSS for particles
|
609 |
+
const style = document.createElement('style');
|
610 |
+
style.textContent = `
|
611 |
+
@keyframes particle-fly {
|
612 |
+
0% { transform: translate(0, 0) scale(1); opacity: 1; }
|
613 |
+
100% { transform: translate(${Math.random() * 100 - 50}px, ${Math.random() * 100 - 50}px) scale(0); opacity: 0; }
|
614 |
+
}
|
615 |
+
|
616 |
+
.explosion-particle {
|
617 |
+
position: absolute;
|
618 |
+
border-radius: 50%;
|
619 |
+
pointer-events: none;
|
620 |
+
}
|
621 |
+
`;
|
622 |
+
document.head.appendChild(style);
|
623 |
+
|
624 |
+
// Handle window resize
|
625 |
+
window.addEventListener('resize', function() {
|
626 |
+
// For simplicity, we'll just redraw without changing canvas size
|
627 |
+
draw();
|
628 |
+
});
|
629 |
+
});
|
630 |
+
</script>
|
631 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=drmurataltun/e-ik-at-sim-lat-r" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
632 |
+
</html>
|
prompts.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
hedef vurmalı eğik etış simülasyonuı oyunu yap.
|
2 |
+
poweer kısmı çok güçsüz kaldı
|