Sign in to follow this  
roko68

NOOB - code structure, syntax etc.

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!!!!

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.