roko68 Posted April 21, 2015 Share Posted April 21, 2015 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 More sharing options...
eguneys Posted April 21, 2015 Share Posted April 21, 2015 You should use and adapt a phaser template like a yeoman generator. It will generate the boilerplate for you and you will only have to code your game. https://github.com/rblopes/my-phaser-template roko68 1 Link to comment Share on other sites More sharing options...
mwatt Posted April 21, 2015 Share Posted April 21, 2015 Here's another approach, one that worked for me. I went to https://academy.zenva.com and bought the online "HTML5 Mobile Game Development with Phaser" course. I think it was $19. The lessons were good and they show you a good way to structure your projects. roko68 1 Link to comment Share on other sites More sharing options...
eguneys Posted April 21, 2015 Share Posted April 21, 2015 You can also read my free article http://www.sitepoint.com/javascript-game-programming-using-phaser/, about how to structure levels for a Phaser game. roko68 and fonso 2 Link to comment Share on other sites More sharing options...
roko68 Posted April 22, 2015 Author Share Posted April 22, 2015 Good tips guys. Thank you! I'll check out these links you've provided. Link to comment Share on other sites More sharing options...
fonso Posted March 5, 2019 Share Posted March 5, 2019 Thank you for your great tutorial, I learned a lot, thanks a bunch! Link to comment Share on other sites More sharing options...
Recommended Posts