rimdeker Posted March 3, 2016 Share Posted March 3, 2016 I am trying to understand the Phaser source code and came across a weird part that I just can't figure out. Where and how are the properties (references) in State set to the actual objects that we later use? I thought that "this" might point to Phaser.Game later (i.e. by calling the Phaser.State methods from the Phaser.Game object) but printing out "this" from within a Phaser.State object does in fact return a Phaser.State object. So now I'm all confused about where these references are updated. Link to comment Share on other sites More sharing options...
Tom Atom Posted March 3, 2016 Share Posted March 3, 2016 Hi, look at StateManager.js: https://github.com/photonstorm/phaser/blob/v2.4.6/src/core/StateManager.js#L452 These references are set when state is set as current one: https://github.com/photonstorm/phaser/blob/v2.4.6/src/core/StateManager.js#L516 rimdeker 1 Link to comment Share on other sites More sharing options...
rimdeker Posted March 3, 2016 Author Share Posted March 3, 2016 9 minutes ago, Tom Atom said: Hi, look at StateManager.js: https://github.com/photonstorm/phaser/blob/v2.4.6/src/core/StateManager.js#L452 These references are set when state is set as current one: https://github.com/photonstorm/phaser/blob/v2.4.6/src/core/StateManager.js#L516 Holy hell. Thank you so much. I've been looking and grepping all over the files all night. Totally missed this! Link to comment Share on other sites More sharing options...
Recommended Posts