/phacer

Primary LanguageJavaScript

Phacer

2D racer game.

Live

Technologies Used

  • React & Redux (frontend)
  • Node & Express (backend)
  • Phaser JS (gaming engine)

Chat code snippet

It was very easy to add a global chat using socket.io:

app.js

const socket = require('socket.io');
//...
const io = socket(server);
io.on('connection', (socket) => {
  socket.on('SEND_MESSAGE', (data) => {
    io.emit('RECEIVE_MESSAGE', data);
  });
});

chat.js

import io from "socket.io-client";
//...
this.socket = io.connect(url);

this.socket.on('RECEIVE_MESSAGE', function (data) {
    data['timestamp'] = new Date().getTime();
    addMessage(data);
});

Key features

gif

  • User authentication. Sign up, Log in, Log out, demo user.

  • Timed race to finish line

png

  • Recording of top scores

Future Direction

  • Add multiplayer and rooms

Team

Additional encryption and security provided by