liakos1992 Posted December 13, 2015 Share Posted December 13, 2015 When changing a sprite's x and y in the update loop, the new position will not show until the next update(). This way, when I attach a health bar on a unit with velocity, while the unit is moving the health bar will always be behind that unit. How can I have the rendering to be done AFTER the "update()" loop? Link to comment Share on other sites More sharing options...
weratius Posted December 13, 2015 Share Posted December 13, 2015 maybe you can set a bar's fixedToCamera property to true creating it with the nescessary starting coords Link to comment Share on other sites More sharing options...
liakos1992 Posted December 13, 2015 Author Share Posted December 13, 2015 I want to render the game after update() for various reasons Link to comment Share on other sites More sharing options...
liakos1992 Posted December 14, 2015 Author Share Posted December 14, 2015 bump Link to comment Share on other sites More sharing options...
drhayes Posted December 14, 2015 Share Posted December 14, 2015 As to the health bar, check out preUpdate, which is where the positions of things are calculated. Don't forget to call the base class' preUpdate method too... important stuff happens there. As to rendering the game after update: that's a pretty fundamental change to how Phaser's rendering cycle works. "render after update" is the solution; what's the problem? Link to comment Share on other sites More sharing options...
Recommended Posts