How do I keep a spritefont on top of a player?

0 favourites
  • 2 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I pin it on the player and it stays there, but when the player grows the spritefont is basically centered inside the player, so how could I keep it constantly at a certain height above the player no matter the players size? If you still don't understand I'm looking for a username-floating-above-head effect you would see from LOTS of games, but still above his head no matter his size.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You have to unpin the spritefont and set the y-position new, after your scaling-event happens.

    event -> Spritefont | Pin unpin
          -> Spritefont | player.Y-player.Height/2-SpriteFont.height
          -> Spritefont | Pin pin to Player
    [/code:fcnbet1m]
    
    If your scaling is continuous you could use every tick instead of pin to set the position of the spritefont every tick. 
    
    System| every tick -> SpriteFont| Set position to (player.X-SpriteFont.Width/2, Player.Y-Player.Height/2-SpriteFont.height)
    
    The origin has to be in the middle of your Player-sprite.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)