parent
b2f25ca029
commit
4505d544c3
@ -0,0 +1,16 @@
|
||||
userObj = require("./storageObjects/userObj.js")
|
||||
|
||||
function handleAction(actionObj, user){
|
||||
switch (actionObj.action) {
|
||||
case "buy":
|
||||
userObj[user.data.name].purchasePower(actionObj.power)
|
||||
return {status: "Done!"}
|
||||
case "bomb":
|
||||
userObj[user.data.name].bomb(actionObj.location, actionObj.radius)
|
||||
return {status: "Done!"}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = handleAction
|
@ -1,2 +1,2 @@
|
||||
creaturesObj = {}
|
||||
module.exports = creaturesObj
|
||||
// creaturesObj = {}
|
||||
// module.exports = creaturesObj
|
@ -1 +1,2 @@
|
||||
require("./webServer/express")
|
||||
require("./game/gameControl.js")
|
@ -0,0 +1,11 @@
|
||||
const { WebSocketServer } = require('ws');
|
||||
|
||||
const wss = new WebSocketServer({ port: 8889 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
||||
ws.send('something');
|
||||
});
|
Loading…
Reference in new issue