I am learning PHASER HTML5 game dev framework based on javascript, during which I came across this piece of code which I am not able to understand
var BunnyDefender = {};
BunnyDefender.Boot = function(game) {};
BunnyDefender.Boot.prototype = {
preload: function()
{
//-----to load objects and units before we begin our game
this.load.image('preloadbar', 'images/loader_bar.png');
this.load.image('titleimage', 'images/TitleImage.png');
},
create: function()
{
this.input.addPointer();
this.stage.backgroundColor = '#171642';
this.state.start('Preloader'); // launches preloader from Boot.js
}
};
Here from what I had learnt about javascript prototyping was that , to add any method to an object or constructor function we used the following syntax/example:
function employee(name,jobtitle,born)
{
this.name=name;
this.jobtitle=jobtitle;
this.born=born;
}
var fred=new employee("Fred Flintstone","Caveman",1970);
employee.prototype.salary=null;
fred.salary=20000;
Please help !!!