Mike018 Posted July 13, 2017 Report Share Posted July 13, 2017 When I have many objects always referencing the game and the game height, it is better to create my own variables at the beginning and reference them or keep using the in-game variables? Not sure if it stores everything after the first time. this.game; this.game.world.height; or this.game_ = this.game; this.gameHeight_ = this.game.world.height; Quote Link to comment Share on other sites More sharing options...
Beyb26 Posted July 13, 2017 Report Share Posted July 13, 2017 The second one is better. Quote Link to comment Share on other sites More sharing options...
Skeptron Posted July 13, 2017 Report Share Posted July 13, 2017 I'd better always use this.game.world.height, as it may vary. With your second option, you will have the height value at the time you create your variable, but if later on the game is resized the value will no longer be accurate, whereas this.game.world.height will always be correct. Juan 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.