MizoTheDev Posted February 12, 2017 Share Posted February 12, 2017 Hey there! I'm trying to make a Speak Bubble follow the player so I use this code if (typeof(speakBubble.speaker) !== "undefined") { speakBubble.position.x = speakBubble.speaker.position.x + speakBubble.speakerOffsetX; speakBubble.position.y = speakBubble.speaker.position.y + speakBubble.speakerOffsetY - speakBubble.parts.center.height; } in the update function of the game state. The player or "speaker" has arcade physics applied to it and moves in a platformer manner. The problem is that the speak bubble updates BEFORE the physics system updates the player so it shifts slightly to the right when the player moves left and left when they move right, etc. Is there a function that I can use to update the speak bubble AFTER physics update (perhaps like the LateUpdate() function in Unity)? Link to comment Share on other sites More sharing options...
hexus Posted February 13, 2017 Share Posted February 13, 2017 preRender() might help you there. Quote The preRender method is called after all Game Objects have been updated, but before any rendering takes place. Source code: core/State.js (Line 171) samme 1 Link to comment Share on other sites More sharing options...
Recommended Posts