feat: docker stuff

This commit is contained in:
2025-07-12 14:21:31 +02:00
parent 5361076f41
commit 65101bd3fa
11 changed files with 47 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM caddy:2-alpine
# Copy all static files to Caddy's default serve directory
COPY . /usr/share/caddy/
# Create Caddyfile for HTTP only serving
RUN echo "# Caddyfile" > /etc/caddy/Caddyfile && \
echo ":80 {" >> /etc/caddy/Caddyfile && \
echo " root * /usr/share/caddy" >> /etc/caddy/Caddyfile && \
echo " file_server" >> /etc/caddy/Caddyfile && \
echo "}" >> /etc/caddy/Caddyfile
# Expose port 80
EXPOSE 80
# Caddy will automatically use the Caddyfile in /etc/caddy/

5
docker-compose.yml Normal file
View File

@ -0,0 +1,5 @@
services:
game:
build: .
ports:
- 8132:80

View File

@ -195,6 +195,18 @@
highScore: localStorage.getItem('zombieHighScore') || 0 highScore: localStorage.getItem('zombieHighScore') || 0
}; };
// Audio loader
const sounds = {
gunshot: new Audio('386845__morganpurkis__single-gunshot-52.wav'),
zombieGrunt: new Audio('426627__mrh4hn__zombie-grunt.wav'),
playerOuch: new Audio('421877__sventhors__ouch_1.wav')
};
// Set volume levels
sounds.gunshot.volume = 0.3;
sounds.zombieGrunt.volume = 0.5;
sounds.playerOuch.volume = 0.7;
// Sprite loader // Sprite loader
const sprites = {}; const sprites = {};
const spriteList = [ const spriteList = [
@ -669,6 +681,11 @@
} }
this.lastShot = Date.now(); this.lastShot = Date.now();
// Play gunshot sound
sounds.gunshot.currentTime = 0;
sounds.gunshot.play().catch(e => console.log('Audio play failed:', e));
updateUI(); updateUI();
} }
@ -965,6 +982,10 @@
// Zombie died // Zombie died
game.score += 10; game.score += 10;
// Play zombie grunt sound
sounds.zombieGrunt.currentTime = 0;
sounds.zombieGrunt.play().catch(e => console.log('Audio play failed:', e));
// Random weapon drop (increased rate) // Random weapon drop (increased rate)
if (Math.random() < 0.4) { if (Math.random() < 0.4) {
const weaponKeys = Object.keys(weaponTypes); const weaponKeys = Object.keys(weaponTypes);
@ -999,6 +1020,11 @@
if (now - game.player.lastDamage > 1000) { if (now - game.player.lastDamage > 1000) {
game.player.health -= 10; game.player.health -= 10;
game.player.lastDamage = now; game.player.lastDamage = now;
// Play player ouch sound
sounds.playerOuch.currentTime = 0;
sounds.playerOuch.play().catch(e => console.log('Audio play failed:', e));
updateUI(); updateUI();
if (game.player.health <= 0) { if (game.player.health <= 0) {