Private variables with that method:


You can make private variables in the init method, for example. You just need to make getters and setters as well, i.e.

init: function() {   // Private var   var _div = $( div );   // Priviledged method accesses private var   this.getDiv = function () { return _div; }   this.setDiv = function (div) { _div = div; }   // other initialization stuff }

Downside is that the privileged getters and setters can’t be put in the prototype, i.e. they are created for each instance separately. Another issue is the overhead of closures in general.

Interesting Information about extending prototypes:

Reading files with javascript:

javascript private scope, maybe a good read:


Times are Tough

Times are tough these days. Massive fork on the road with this project. I have two options at this stage, either:

1) use Melon.js as the base game engine and have a nicely finished product, however it will be harder to write about

2) Write it from scratch, more to talk and write about, but potentially a non-functional/buggy product.

My heart says use Melon.js and force something to write, however, I’m not sure if I can..