Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

STUCK: setTint on Text GameObject doesn't appear to be working for me


blade2xs
 Share

Recommended Posts

Hey guys, I am using Phaser 3.8.0

I was looking at this as an example https://labs.phaser.io/view.html?src=src\input\mouse\text input test.js

and it appears to be working on Phaser 3.8.0 on the sample but when I use the code below in my scene's "create" method, I can see the event in my console logs and if I change the code to "setColor('red')" the text properly turns red... just curious what I am doing wrong here or missing with setting the tint of the font?

 

encounterSceneContext.menuAttack = this.add.text(55, 210, "Attack", { fontSize: '10px', fill: '#ffffff' });
            encounterSceneContext.menuRun = this.add.text(55, 225, "Escape", { fontSize: '10px', fill: '#ffffff' });

            encounterSceneContext.menuAttack.setInteractive(
                new Phaser.Geom.Rectangle(0, 0, encounterSceneContext.menuAttack.width, encounterSceneContext.menuAttack.height),
                Phaser.Geom.Rectangle.Contains);

            encounterSceneContext.menuRun.setInteractive(
                new Phaser.Geom.Rectangle(0, 0, encounterSceneContext.menuRun.width, encounterSceneContext.menuRun.height),
                Phaser.Geom.Rectangle.Contains);

            this.input.on('gameobjectover', function (pointer, gameObject) {
                console.log("gameobjectover");
                gameObject.setTint(0xff0000, 0xff0000, 0xffff00, 0xff00ff);
            });

            this.input.on('gameobjectout', function (pointer, gameObject) {
                console.log("gameobjectout");
                gameObject.clearTint();
            });

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...