This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

So, if I create a button using TouchScreenButton and assign a texture to it, the texture will be displayed on the left bottom of the TouchScreenButton position (See image below)

enter image description here

The TouchScreenButton position is in the top left corner of the rectable

When I don't assign a texture and instead I create a sprite as the child node and assign a texture to it, it will display the texture in the center of TouchScreenButton.

enter image description here

But the shape is still follows what I have said earlier.

My question, How do I create the center of TouchScreenButton texture in the center of the TouchScreenButton position along with it's shape?

in Engine by (14 points)
edited by

I want the TouchScreenButton is in the middle of the TouchScreenButton texture.

I'm afraid i can't follow: that's the default and shown by your first screenshot. The second screenshot only looks different because the Sprite is centered around the position of the TouchScreenButton instead of its center-point. I don't understand what you're trying to highlight with that, but you can uncheck the centered-property of the Sprite, if you want to change that.

Sorry if the question is not clear enough, I have removed the last sentence.

I it's the anwer, I have to uncheck the centered shape property to make the shape in the center of the TouchScreenButton.

The solution is I have to create a sprite as a child node and uncheck the centered shape property

I still don't get what you're trying to do, sorry. If you uncheck the "Shape Centered" property then the shape won't be in the center of the TouchScreenButton but in its upper left corner! There's no built-in way to move the Texture there as well. But why would you want to do that in the first place?

If I uncheck the "Shape centered" then the center of the shape will be exatly in the button position right? I need it because the I need the button location to be parallel with other node

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.