s6reinan Posted February 17, 2017 Share Posted February 17, 2017 I'm having problems transferring sprite from another sprite to stage and then back to another sprite. The scenario is I have two rotating sprites (wheels) and another sprite (player). Initially, the player is added to wheelA as a child. Upon pressing fire, the player is removed from wheelA and its velocity is changed so that it moves away from wheelA. (Player is removed from wheelA so that it ignores wheelA's rotation). The player is also added to the game via game.add.existing(player); (Since it doesn't render after removing from wheelA). On update, I check if player overlaps with wheelB. On overlap, I disable the physics of the player and add it as child of wheelB. The result is player is not rendered on the scene although it is a child of wheelB. Link to comment Share on other sites More sharing options...
samme Posted February 17, 2017 Share Posted February 17, 2017 10 hours ago, s6reinan said: The result is player is not rendered on the scene although it is a child of wheelB. Check that the player's `parent` is wheelB (and not null). Check that the player's `position` is what you want (maybe [0, 0]). It may be off screen. Link to comment Share on other sites More sharing options...
s6reinan Posted February 20, 2017 Author Share Posted February 20, 2017 On 2/18/2017 at 5:35 AM, samme said: Check that the player's `parent` is wheelB (and not null). Check that the player's `position` is what you want (maybe [0, 0]). It may be off screen. Checked already. wheelB is not null and the position is 0,0. Link to comment Share on other sites More sharing options...
Recommended Posts