Jump to content

lateUpdate in Phaser?


MizoTheDev
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...