Jump to content

NOOB - code structure, syntax etc.


roko68
 Share

Recommended Posts

Hi. I'm trying to wrap my head around how to build some simple games. I'm really struggling with how to use code examples from here:

http://phaser.io/examples

 

***This structure is used:

 

function preload() {   
}
 
function create() {
}
 
function update() {   
}

 

etc, etc. 

 

... and integrate them with code examples from here:

http://gamemechanicexplorer.com/

 

 

*** This structure is used:

 

var GameState = function(game){

}

 

GameState.prototype.preload = function() {

}

 

GameState.prototype.create= function() {

}

 

GameState.prototype.update= function() {

}

 

Is there a good way to adapt code from one structure to another? Is one structure better than the other, or why would it be coded differently? Sorry if it's been explained somewhere in the forums. I've been searching! Any advise, or optimally would anyone have some code examples/sites that can help me make sense of this? Thanks!!!!

 

 

Link to comment
Share on other sites

  • 3 years later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...