add node.js and deploy on firebase

This commit is contained in:
Tomas Krejci 2023-07-14 22:22:38 +02:00
parent 78b94d300c
commit 36c512051a
19 changed files with 3571 additions and 2 deletions

View File

@ -0,0 +1,12 @@
src/obstacle.js,1682402704000,f61f27bd17de546264aa58f40f3aafaac7021e0ef69c17f6b1b4cd7664a037ec
index.html,1689364624703,773cd732a8479496eee7b0b6dc345256fb52b8893683af18897954c53d4c3b57
favicon.ico,1682498600000,6382de85a501d60e3135766fec4b0dfb0dc4493547b7b9df190be00fa34b39e7
src/ai.js,1689292020000,e5000bbe5faff02f4cd81ebff6ab2e764bebbb9bde26fb1388144314b830a915
src/bomb.js,1689292002000,0821613d0b7d2dad682a2405c1241a7f735ad22b3dda7adb9e0edaad1d161ff9
src/game.js,1689365212827,517d1b39eb837b7b55bfb4a9763b03d7d39cb338430e2a9a52338da3fcab183d
src/physics.js,1684415924000,d3176228a26f9f1575899c6659add9b36e77f03f0fc49c0a97d096789d884ab6
src/player.js,1689292037000,5591cc5f4f316e1f7b883e2e5abcf2aa7e1df4df8b39413333982074f14c6cee
src/utils.js,1684512384000,c19963aa2473e94762aa74f9e4f40131cd075430e087400f1bdfabe9749555f6
sound/explosion.mp3,1682402704000,758ace0a15048014152ada137e1cd2238458d7b7e88c054abc81aa8389735f88
p5.sound.js,1682402704000,98b1033ed758be2c825ec9da8417ebd09d32622c5775e29cca04f23c6b0196dc
p5.js,1682402704000,46d813562e21b63e366878f76c08a2fe8bdbddec50d7ee4528aa53d13b22ef8e

5
.firebaserc Normal file
View File

@ -0,0 +1,5 @@
{
"projects": {
"default": "octopusbomb-297bf"
}
}

16
firebase.json Normal file
View File

@ -0,0 +1,16 @@
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}

3502
package-lock.json generated

File diff suppressed because it is too large Load Diff

16
package.json Normal file
View File

@ -0,0 +1,16 @@
{
"dependencies": {
"express": "^4.18.2",
"node-p5": "^1.0.4",
"socket.io": "^4.7.1"
},
"scripts": {
"start": "node server.js"
},
"name": "octopusbomb",
"description": "JS Bomberman clone.",
"version": "1.0.0",
"main": "server.js",
"author": "Tomas Krejci",
"license": "ISC"
}

View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -9,6 +9,7 @@
<script src="https://cdn.tailwindcss.com"></script>
<script src="p5.js"></script>
<script src="p5.sound.js"></script>
<script src="https://cdn.socket.io/4.5.4/socket.io.min.js"></script>
<script src="src/index.js"></script>
<script src="src/ai.js"></script>
<script src="src/game.js"></script>

View File

View File

@ -28,7 +28,11 @@ const snapBomb = false;
let explosionSound;
var socket;
function setup() {
socket = io.connect('http://localhost:3000');
createCanvas(windowWidth, windowHeight);
//createCanvas(cols * cellSize, rows * cellSize);
explosionSound = loadSound("sound/explosion.mp3");

17
server.js Normal file
View File

@ -0,0 +1,17 @@
var express = require('express');
var app = express();
var server = app.listen(3000);
app.use(express.static('public'));
console.log("OctopusBomb socket server is running");
var socket = require('socket.io');
var io = socket(server);
io.sockets.on('connection', newConnection);
function newConnection(socket) {
console.log('New connection:' + socket.id);
}

View File