Sign in to follow this  
spinnerbox

Setting width and height to Phaser.Text behaves strangely?

Recommended Posts

I am using this code to create my text field on screen:

screenTypingTextField = gameObject.add.text(200, 520, "", si.Utility.getTextStyleScreenTypingTextGreen());
screenTypingTextField.alpha = 0.5;
screenTypingTextField.anchor.setTo(0.5, 0.5);
//screenTypingTextField.width = 480;
//screenTypingTextField.height = 240;
thisObject.menuObjects.add(screenTypingTextField);
textStyleScreenTypingTextGreen = {
            font :'70pt Arial',
            align : 'center',
            fill: 'Green'
        },

As you can see I have commented the width and height rows.

Its because when i run this code again by entering the same scene that uses this code, it then starts to spread the text over all screen, even bigger.

Is this the right way to create text and then set its width and height?

Or I should just use the font to set text field size?

here is a picture of my typing text field in green spread all over the screen

bug-screen.png.6cb0cc70c1349aeb57374f139bfd16d2.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.