I would like to know if there is any text direction on Phaser.js Text class like when user input some text, then the text input in the canvas will have a text direction of right to left or left to right;
and I'm implementing this on whole canvas application
example in the normal html we can attain this using the css properties
direction:ltr,
direction:rtl
anyone has any idea on how to do it.
i was reading on the phaser.js text class but cannot find any properties to set the direction to right to left but no luck.
thanks in advance;
Since I can't find any documentation on the phaser to make this happen then i simply just make a work around to look like i am able to make the direction of the text to be right align.
Here is a simple text
var txt = this.game.add.text(10, 10, '0', {
font: "21px arial",
fill: "#00FF00",
align:'right',
fontWeight:'bold',
});
compute for the new position x of the txt
formula :
txt.x = contant - txt.width
the constant will be a reference point you want to offset according to your positioning
so when the variable txt text updated
then you can re-position it again using the the new data
txt.setText(100);
txt.x = 84 - (txt.width);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With