Aram Posted June 13, 2018 Share Posted June 13, 2018 Hi all, Could someone tell, is it possible to create sprite not in Scene class? For example my scene class has obj of ClassA, how can I create sprite in classA? Do I have to keep scene Ref in ClassA and then create through it? Thank you! Link to comment Share on other sites More sharing options...
snowbillr Posted June 13, 2018 Share Posted June 13, 2018 A Sprite's constructor looks like this (https://github.com/photonstorm/phaser/blob/master/src/gameobjects/sprite/Sprite.js#L77) function Sprite (scene, x, y, texture, frame) So wherever you create your Sprite, you'll need to pass in a reference to the scene. This could be anywhere in your codebase, as long as you are able to have a reference to that scene. Link to comment Share on other sites More sharing options...
Aram Posted June 13, 2018 Author Share Posted June 13, 2018 Thank you very much! Link to comment Share on other sites More sharing options...
Recommended Posts