简体   繁体   中英

Phaser3 ascii graphics

Does anyone know how can I use text as sprites in phaser3? I could create a sprite with an ascii spritesheet but because I want the text (in my case the sprites) to change colour, that solution wouldn't be optimal.

In phaser2 I could create an empty bitmapdata object and use it as the graphic for my sprite, but in phaser3 there is no such a thing.

Should I create a sprite with a transparent png as the graphic and then add the text to it? Is this a good solution or would it be an overkill, as in my game I want everything to be ascii characters?

Any help would be appreciated. Thank you

Your original solution of using a Sprite with an ASCII spritesheet will work fine. You can have white lettering and use the setTint() , clearTint() , and isTinted property to change the color while also being able to Sprite-related stuff.

  1. Tinting Demo
  2. Source Code
  3. Phaser 3 Sprite Doc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM