Gw Temp

Menu

Tutorial - 'Draw Functions in Game Maker' by Chronic

An item about Gamemaker posted on

Blurb

Here are some drawing functions in Game Maker

Body


I know you all want to make an RPG, and what do you need to make an RPG? Some text functions. Now, Game Maker is not like RPG Maker 2000, and has a built in textbox, you have to make it yourself in Game Maker. I will show you how. There are many ways. I'll show you the first.

-----------
$dialog_box
-----------

This will have a background at the bottom of the page, and it will also have text, just like a normal textbox. Put this in your scripts section. Let's name it dialog_box.

{
screen_redraw();
font_size = 20;
font_style = fs_bold;
draw_sprite(text_box,0,32,10);
screen_refresh();
draw_text(43,20,argument0);
draw_text(43,58,argument1);
draw_text(43,96,argument2);
if(argument3) draw_sprite(text_more,0,575,115);
screen_refresh();
keyboard_wait();
}

Theres some explaining to this. You see where it says draw_sprite? Well, there's the word 'textbox' in there. Replace textbox with the name of the sprite OF your background you want for the text.

The two numbers after draw_text are the coordinates. Argument0 is line one, and so on to line three. So, when you want to use dialog_box, use this.

dialog_box('Line1','Line2','Line3',0)

Let's move to the more simple way of doing this.

---------
draw_text
--------

Draw_text simply does exactly what it says, it draws text.

Let's take a look at it:

draw_text(43,58,'What text you want here')

43 is the X position you want to draw it at, 58 is the Y position, and the last part is self explanatory. That should explain that. Want a different color? Let's work with that

---------------------
Enhanced Colors/Fonts
---------------------

So you want your text bold? Do you want it a different color? I will show you how.

----------------

font_color == red

This changes your font color to red.

-------------------

font_size == 21

This changes your font size to 21. Change 21 to whatever you want.

---------------

font_style = fs_bold

This changes your font style to whatever you want. The following flags are avaible.

fs_normal = Brings your text back to normal

fs_bold = Changes your text to bold

fs_italic = Changes your text to italic

fs_bolditalic = Changes your text to bold and italic

---------------

font_align = fa_left

This changes your text to left aligned. The following flags are available:

fa_left = Changes the alignment to the left

fa_center = Changes the alignment to the center

fa_right = Changes the alignment to right

-----------------------------

The following are availble. Please use them to your fullest extent, and I hope this tutorial helps you.