Shofra Posted March 7, 2016 Share Posted March 7, 2016 I'm just learning how to code with HTML5 and Phaser, so bear with me. I've been looking at a lot of different tutorials, and I've noticed something that I'm hoping someone can explain to me. In tutorials or examples on the Phaser site, functions are written out the way I'm used to: function preload() { //stuff } But in some of the tutorials, functions are written like this: preload: function() { //stuff } I've found that, at least using Intel XDK and Cordova, only the latter functions on the phone emulation. My question is, what's the difference? Is it Cordova that only accepts this format? Is there anything I have to keep in mind when I'm writing functions this way? It's just worrisome to me that I don't know why it's like this. I've tried searching for the information, but to no avail--I can't find the right keywords to get me any information. Thanks! Link to comment Share on other sites More sharing options...
stupot Posted March 7, 2016 Share Posted March 7, 2016 Hi, I think the colons you are seeing are when the functions are being defined in an object, ie a comma separated list of properties within a { } Link to comment Share on other sites More sharing options...
Recommended Posts