Mega's Message Box Example

by Mega


Posted on December 05, 2013 at 9:28 AM



Made this for my F4D 2013 entry, and decided to separate the code and upload it as an example.

This adds two message boxes; one with a simple OK response, one with a Yes or No response. Both can have scripts attached to them that run when a response is chosen.

They fold out and fade in, and have a pulsing selector. It's a nice little effect, and makes for a better way of exiting your games.

Usage To create a new Yes/No message box, do something like the following:
i = instance_create(0,0,msgbox_yesno);
i.message = "Message#with#newlines";
i.fg = <foreground color here>
i.bg = <background color here>
i.yes_script = sc_exit;
i.no_script = sc_dummy;
i.sel = 1;
i.font = myfont;

The code references a font called fnt_msgfont, so if you use it in a game you'll have to either add that or change the reference.


JID commented December 05, 2013 at 10:20 PM
pretty simplistic stuff, though it gets the job done and looks pretty smooth while doing it..

8/10