Draw Text on screen

Baka-chan

☆*:.。. o(≧▽≦)o .。.:*☆
Veteran
Joined
Dec 19, 2012
Messages
490
Reaction score
148
First Language
German
I'd like to know how to display a text/variable on the screen. I made a time plugin and want to display the time on the screen but don't know how to get the text to be drawn on the screen.
 

Jeremy Cannady

Coldfire
Veteran
Joined
Oct 25, 2015
Messages
449
Reaction score
268
First Language
English
I would start by thinking about what other things draw text on the screen.

I can think of the map name will appear, this is where I would start.

You will have to make it apart of the Scene_Map so it can display.
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,698
Reaction score
936
First Language
English
Primarily Uses
N/A
To save yourself the trouble of all that backtracking, you'll need to create a sprite, in this case it seems Sprite_Base will do fine. Then, with that sprite you need to attach a new Bitmap to it, which is the part you can actually draw on. Once this is done, you need to, within the scene itself, call 

this.addChild(mySprite)where mySprite is the variable you used when you created the sprite. Now that we got all the technicalities out of the way, feel free to draw on the sprite like so:

mySprite.bitmap.drawText("text", x, y, maxWidth, lineHeight, "alignment")For the specifics of the drawText function, check the manual's documentation for Bitmap, it'll be there.
 

Latest Threads

Latest Posts

Latest Profile Posts

3am me: So how do you feel about a character inviting their own character portrait to a tea party? =D

3pm me: //facepalms
I turned 17 two months ago and I feel like I've grown (personality-wise) more in this 1 year than all the 16 years I had lived combined.
Ugh, I may have been cumbersomely eventing a bunch of stuff I could have easily done changing the tileset "Passage (4 dir)" and "Ladder" options. Oops :D
I have no idea why some of the program "splash screen" always on top. E.g, RMMZ loading screen stuck on the top blocking anything I want to do until it fully loaded. What is even the purpose?
One of the secret places in the game.

Forum statistics

Threads
107,640
Messages
1,031,076
Members
139,763
Latest member
Kesharikbrando
Top