How do I

Just started using Construct 2? Post your questions here

Post » Thu Aug 27, 2015 10:29 am

Hi, I'm new on Construct 2... I have a problem with my first game:
How make a good scaling on two sprites (one button with one SpriteFont text inside) concurrently, but having the SpriteFont alwyas centered into the button?
B
6
S
1
Posts: 4
Reputation: 330

Post » Fri Aug 28, 2015 11:48 pm

You can set the origion point ofthe button to its center and you can also set the "Hotspot" for SpriteFont. Put them at the same position (X,Y). Now you can freely scale them as you want, the text will always be at the center of the button
B
10
S
2
G
1
Posts: 51
Reputation: 761

Post » Sun Aug 30, 2015 12:00 pm

Alternately, if you don't want to mess with the font origin point, you can have an event like

>For each SpriteText >Move SpriteText to (Button.X - SpriteText.CharacterWidth/2) , (Button.Y - SpriteText.CharacterHeight/2)

assuming that Button's origin point is in the center and the button text is one letter. Add a multiplier for more letters, and an instance variable for multiple buttons.
B
27
S
5
G
1
Posts: 62
Reputation: 2,367

Post » Mon Aug 31, 2015 8:35 am

Thank you very much! :D
B
6
S
1
Posts: 4
Reputation: 330


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 3 guests