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

Get help using Construct 2

Post » Fri Feb 19, 2016 8:03 am

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.
B
27
S
12
G
5
Posts: 79
Reputation: 5,223

Post » Fri Feb 19, 2016 9:48 am

You have to unpin the spritefont and set the y-position new, after your scaling-event happens.

Code: Select all
event -> Spritefont | Pin unpin
      -> Spritefont | player.Y-player.Height/2-SpriteFont.height
      -> Spritefont | Pin pin to Player


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.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider] and 36 guests