Last Issues With DrawText() Function: Fill Color, Outline Color, & Rotation Not Working?

Hi,

Almost done with the DrawText() function.
Having issues with text fill color, text outline color, and text rotation.

Please look at DrawText call below:
https://bitbucket.org/jesseleepalser/phaser-engine/src/15fe11a631a83272b16e1a562d1d5be109b686a1/coreLogic.js#lines-130

Please look over DrawText source code below:
https://bitbucket.org/jesseleepalser/phaser-engine/src/15fe11a631a83272b16e1a562d1d5be109b686a1/coreVisuals.js#lines-161

Thanks!

Jesse

DrawText() seems to be doing too much, and its return value is confusing. I would guess the indexes are getting mixed up, but you need to use the debugger or some console logging to find it.

Do you need to index text objects numerically? It seems you could just create

scoreText = this.add.text(…);

like the others. And in collectStar(), all you really need is

scoreText.text = score;

Also, Text colors are all CSS colors (strings), e.g. 'red', 'rgb(255,0,0)', 'rgba(255,0,0,0.5)'.

Ok, let me hit it with a hammer now…

Hi,

I tried below just now, does not seem to change to color though?

Jesse

var redFill = 255;
var greenFill = 0;
var blueFill = 0;
var fillColor = new Phaser.Display.Color('rgb(redFill, greenFill, blueFill)'); // Is this correct? Does not seem to do anything in browser?
Texts[textIndex].color = fillColor.color;
textGameObject.setFill('rgb(255,0,0)');

or

var fillColor = new Phaser.Display.Color(redFill, greenFill, blueFill);

text.setFill(fillColor.rgba);

Hi,

Still not working…

I setup the text array below:
https://bitbucket.org/jesseleepalser/phaser-engine/src/3227f35d4caa367540ab2519b9fd4e9c73e5415b/coreLogic.js#lines-91

I call the DrawText() function below:
https://bitbucket.org/jesseleepalser/phaser-engine/src/3227f35d4caa367540ab2519b9fd4e9c73e5415b/coreLogic.js#lines-97

The updated DrawText() function is below:
https://bitbucket.org/jesseleepalser/phaser-engine/src/3227f35d4caa367540ab2519b9fd4e9c73e5415b/coreVisuals.js#lines-164

Both the text fill color and outline color are always black?

Jesse

Here you can see the current demo:

Texts[textIndex].setFill(`rgb(${redFill}, ${greenFill}, ${blueFill})`);

It’s adding 1000 text objects to Texts. But it looks like you only need fpsText and scoreText.

Hi,

Thank you, that worked!
I use an array of texts like a circle, when exhausted it starts again at the beginning.
Should be ok now, thanks for your help and support…

Jesse

But you don’t need to use 1000 text objects. You only need 3 or so.

I lowered the texts to 500 for now.
Very early in development, I will adjust later on.
(there will be a staff scroll screen with many texts)

Thanks!

Jesse