Created
November 3, 2012 18:10
-
-
Save pjnovas/4008161 to your computer and use it in GitHub Desktop.
Share Scene logic client & server side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isClient = (typeof global === "undefined") ? true : false; | |
(function(arkanoid) { | |
var arkanoid = arkanoid || {}; | |
if (!isClient){ | |
arkanoid.Ball = require('./Ball.js'); | |
arkanoid.Padd = require('./Padd.js'); | |
} | |
var Scene = function() { | |
this.ball = new arkanoid.Ball(); | |
this.padd = new arkanoid.Padd(); | |
}; | |
Scene.prototype.update = function() { | |
this.ball.update(); | |
this.padd.update(); | |
}; | |
Scene.prototype.draw = function() { | |
this.ball.draw(); | |
this.padd.draw(); | |
}; | |
arkanoid.Scene = Scene; | |
})(isClient ? window.arkanoid : exports); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment