megmut Posted September 28, 2015 Share Posted September 28, 2015 Hey guys, just a quick question.. is there any reason to take preference to drawing images in the create function over the preload function?I am aware of the order in which the init, create, preload and update loop are fired, just curious to see what other pahser dev's have made general good practice or if I'm wrong and there is a very good reason to do one, over the other! Just for clarification.. I'm talking about..preload: function() { this.object = this.add.image(x,y,name);}as opposed to..create: function() { this.object = this.add.image(x,y,name);}Thanks! Link to comment Share on other sites More sharing options...
rich Posted September 28, 2015 Share Posted September 28, 2015 As long as the image actually exists and has been loaded in a previous State then there is no technical reason why it can't be instantiated inside the 'preload' method. Providing you'll never need to share your code with anyone else (or post it to this forum for help) and you're happy living in a topsy turvy world where you make all your objects in a preload method, then it won't cause any harm to do so. I wouldn't call it 'bad' practise, that seems a little harsh. But it is a very strange way to do it. Link to comment Share on other sites More sharing options...
megmut Posted September 28, 2015 Author Share Posted September 28, 2015 Thanks! I'll be sure to start rendering from the create function from now on then Link to comment Share on other sites More sharing options...
georgejfrick Posted September 29, 2015 Share Posted September 29, 2015 As long as the image actually exists and has been loaded in a previous State then there is no technical reason why it can't be instantiated inside the 'preload' method. Providing you'll never need to share your code with anyone else (or post it to this forum for help) and you're happy living in a topsy turvy world where you make all your objects in a preload method, then it won't cause any harm to do so. I wouldn't call it 'bad' practise, that seems a little harsh. But it is a very strange way to do it. You always reply to posts like these, but I have a half a dozen posts with serious technical questions about Phaser and they constantly go ignored. I'm struggling trying to use Phaser in professional projects and seeing this pattern is frustrating. Is there something I can do to get better support, or are my posts not well timed? Link to comment Share on other sites More sharing options...
jmp909 Posted September 29, 2015 Share Posted September 29, 2015 Have you checked here, George? http://phaser.io/shop/premium-support georgejfrick 1 Link to comment Share on other sites More sharing options...
rich Posted September 29, 2015 Share Posted September 29, 2015 If I have to approve the post for moderation (like the above was) then I'll often add a quick reply after it. If the post just appears on the forum and doesn't require moderation then yes, it's entirely down to luck if I see it or not when browsing the forum that day. I'm often on the Slack channel though, as are lots of other devs, which is a good place to ask quick questions. If they require lots of debugging of your code then even on Slack I'm likely to be unable to help (otherwise I'd never get anything done). georgejfrick 1 Link to comment Share on other sites More sharing options...
Recommended Posts