• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Drawing text that scrolls at a certain point

N

natdonyoung

Guest
Hi beautiful people out there!

I'm not really a programmer, more a storyteller by trade. But really been enjoying Game Maker Studio.

However, I've been having a tough time drawing text that someone could scroll through. For example, creating something like the textboxes in games like Planescape: Torment, or Baldur's Gate. I like that style, because sometime's you'll miss something, and my game is very text heavy.

Essentially, just want to be able to add text to a single stream when clicking certain objects, and then being able to scroll back, plus making the textbox scroll to the bottom, by default.

I've tried coding my own things for this, but figured out a way to make the text "scroll". Basically just drawing text at this point, using draw_text_ext. Nothing special.

Any help would be greatly appreciated :)
 

3dgeminis

Member
You can use a surface and draw on it. When you draw the surface just draw a part and you change what part to draw.
 
N

natdonyoung

Guest
Thank you so much 3dgeminis! Half the battle has been learning the language to use. I will definitely check out more about surfaces!! You really helped a beginner thank you so much :) :) :) :) :)
 
Unfortunately it's not quite that simple:
  • If you create a surface for all the text and then just draw a part of it you might get a too large surface if you got too much text. So instead you'd rather have the surface as large as the text box and offset the drawing of the text instead.
  • However drawing large text is not very performant. If you got huge amount of text to scroll though you'd rather store each line and draw only the lines needed. But that's kinda complicated.
  • And if your text has semi transparent pixels like in anti-aliased fonts then you should draw the text to the surface in another blend mode. i.e. in (bm_one, bm_zero) or the text will look quite ugly.
  • If you don't want the scrolled text to cut off immediately you might want to fade the lines with a gradient by subtracting a black sprite with an alpha gradient.

I got an example for GMS2 here (without the store-each-line-method though) if you're interested:

 
Top