Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
734
Reaction score
605
First Language
French
Primarily Uses
Hi everyone!


I'm trying to draw text on the map.


I did it by using a picture: here is how I do it:

  • Get the picture id
  • Create a new bitmap for the picture if there is none. The bitmap will be the size of the screen.
  • Display the picture at 0,0
  • Modify the picture bitmap by first clearing it, then drawing text at the x,y coordinates

Game_Screen.prototype.draw_text = function(id,text,x,y,align,width,height) {
width = width || 812
height = height || 624
align = align || "left"
var a = SceneManager._scene._spriteset._pictureContainer.children[id-1]
if (!a.bitmap) {
a.bitmap = new Bitmap(width,height)
}
$gameScreen.showPicture(id, '', 0, 0, 0, 100,100, 255, 0);
a.bitmap.clear()
a.bitmap.drawText(text ,x ,y ,width ,height ,align)
}


What i cannot comprehend is: why is the text displayed mid screen instead of at 0,0 ?


Here is how it looks:

yt4gHHh.png



The script call is:


$gameScreen.draw_text(2,"Alpha",0,0)



If you have any idea why I would be so grateful! I've been searching for hours.


Returning the y position of the picture returns 0 as it should. And by moving the picture to -312 I get the text where it should be. But I am writing on the image at 0,0 not 0,312 so why is the text displayed there?


The project I wrote the function on literally has only that plugin in it. Strictly default other than that, so no interference from any other plugin.


Gah. I don't understand, my function is logical, my script call is valid... Clearly I must be missing something.
 

Latest Threads

Latest Profile Posts

1660090657213.png
Mistakes will be made.
After three years, it was awesome to be back at Gen Con!
Words of Wisdom: You can be honest and alone. Or dishonest and together.
Working on mapping using RPGTools to create parallax maps using PVgames tiles/assets. It's super cool... but mapping is still something I drag my feet on getting done. I hate this but love the math parts of design, which is the opposite of a lot of dev's around, I think. It really do be different strokes for different folks.
Spend $5,000 on a new gaming PC. Didn't expect it to be like 1 foot wide, 2 feet tall, and weigh like 100+ pounds. The heck did I get myself into?

Forum statistics

Threads
124,379
Messages
1,163,210
Members
163,179
Latest member
LeuzyGamer
Top