Permalink
Browse files

Fixing new names of files

  • Loading branch information...
1 parent 8314be1 commit 71c93a210b3ad0cdc0bb2c1f9de4e0c2a38cf1b2 FuzzYspo0N committed Jul 11, 2012
Showing with 350 additions and 378 deletions.
  1. +15 −15 app.js
  2. +20 −26 client.js
  3. +60 −59 game.core.js
  4. +228 −227 game.server.js
  5. +16 −0 index.css
  6. +11 −39 index.html
  7. +0 −12 lib/tween.js
View
30 app.js
@@ -1,13 +1,13 @@
-/* Copyright (c) 2012 Sven "FuzzYspo0N" Bergström
+/* Copyright (c) 2012 Sven "FuzzYspo0N" Bergström
http://underscorediscovery.com
- MIT Licensed. See LICENSE for full license.
+ MIT Licensed.
- Usage : node simplest.app.js
+ Usage : node app.js
*/
- var
+ var
gameport = process.env.PORT || 4004,
io = require('socket.io'),
@@ -31,8 +31,8 @@
console.log('\t :: Express :: Listening on port ' + gameport );
//By default, we forward the / path to index.html automatically.
- app.get( '/', function( req, res ){
- res.sendfile( __dirname + '/simplest.html' );
+ app.get( '/', function( req, res ){
+ res.sendfile( __dirname + '/index.html' );
});
@@ -42,7 +42,7 @@
app.get( '/*' , function( req, res, next ) {
//This is the current file they have requested
- var file = req.params[0];
+ var file = req.params[0];
//For debugging, we can track what files are requested.
if(verbose) console.log('\t :: Express :: file requested : ' + file);
@@ -61,30 +61,30 @@
//Create a socket.io instance using our express server
var sio = io.listen(app);
- //Configure the socket.io connection settings.
+ //Configure the socket.io connection settings.
//See http://socket.io/
sio.configure(function (){
sio.set('log level', 0);
sio.set('authorization', function (handshakeData, callback) {
- callback(null, true); // error first callback style
+ callback(null, true); // error first callback style
});
});
//Enter the game server code. The game server handles
//client connections looking for a game, creating games,
//leaving games, joining games and ending games when they leave.
- game_server = require('./simplest.game.server.js');
+ game_server = require('./game.server.js');
- //Socket.io will call this function when a client connects,
- //So we can send that client looking for a game to play,
- //as well as give that client a unique ID to use so we can
+ //Socket.io will call this function when a client connects,
+ //So we can send that client looking for a game to play,
+ //as well as give that client a unique ID to use so we can
//maintain the list if players.
sio.sockets.on('connection', function (client) {
- //Generate a new UUID, looks something like
+ //Generate a new UUID, looks something like
//5b2ca132-64bd-4513-99da-90e838ca47d1
//and store this on their socket/connection
client.userid = UUID();
@@ -109,7 +109,7 @@
}); //client.on message
//When this client disconnects, we want to tell the game server
- //about that as well, so it can remove them from the game they are
+ //about that as well, so it can remove them from the game they are
//in, and make sure the other player knows that they left and so on.
client.on('disconnect', function () {
View
@@ -1,33 +1,27 @@
- //A global for our game root.
- var game = {};
+ //A window global for our game root variable.
+var game = {};
- //When loading, we store references to our
- //drawing canvases, and initiate a game instance.
- window.onload = function(){
+ //When loading, we store references to our
+ //drawing canvases, and initiate a game instance.
+window.onload = function(){
- //Create our game instance.
- game = new game_core();
+ //Create our game client instance.
+ game = new game_core();
- //Fetch the viewports
- game.debugview = document.getElementById('debug-viewport');
- game.viewport = document.getElementById('viewport');
-
- //Adjust their sizes
- game.viewport.width = game.world.width;
- game.debugview.width = game.world.width;
+ //Fetch the viewport
+ game.viewport = document.getElementById('viewport');
+
+ //Adjust their size
+ game.viewport.width = game.world.width;
+ game.viewport.height = game.world.height;
- game.viewport.height = game.world.height;
- game.debugview.height = game.world.height;
+ //Fetch the rendering contexts
+ game.ctx = game.viewport.getContext('2d');
- //Fetch the rendering contexts
- game.ctx = game.viewport.getContext('2d');
- game.debugctx = game.debugview.getContext('2d');
+ //Set the draw style for the font
+ game.ctx.font = '11px "Helvetica"';
- //Set the draw style for the font
- game.ctx.font = '11px "Helvetica"';
- game.debugctx.font = '11px "Helvetica"';
+ //Finally, start the loop
+ game.update( new Date().getTime() );
- //Finally, start the loop
- game.update( new Date().getTime() );
-
- }
+}; //window.onload
Oops, something went wrong.

0 comments on commit 71c93a2

Please sign in to comment.