You are on page 1of 7

GML EQUIVALENT COMMANDS FOR GUI ACTIONS

In many of the GUI actions, you can choose if the action applies to the current object
instance, the other object instance (e.g. in a collision), or some other object instance
in the game. The GML commands listed below all operate on the current object
instance. If you want the commands to work on the other object instance, use the
with (other) { } construction. See the documentation on the GML Language -
Reference.
MOVE ACTIONS
GUI Action Equivalent GML Commands

Start moving in speed= <expression>; No real equivalence for direction. If you


a direction want a completely random direction, use direction=random(360);

Set direction
and speed of direction= <expression>; speed= <expression>;
motion

Move towards a move_towards_point(x,y,sp);


point

Set the hspeed= <expression>;


horizontal speed

Set the vertical vspeed= <expression>;


speed

Set the gravity gravity= <expression>; gravity_direction= <expression>;

Reverse hspeed= -hspeed;


horizontal direction

Reverse vertical vspeed= -vspeed;


direction

Set the friction friction= <expression>;

Jump to a given x= <expression>; y= <expression>;


position
Jump to the x= xstart; y= ystart;
start position

Jump to a x= random(room_width); y= random(room_height); or


random position move_random(hsnap,vsnap);

Snap to grid move_snap(hsnap,vsnap);

Wrap when move_wrap(hor,vert,margin);


moving outside

Move to contact move_contact_solid(dir,maxdist);


position

Bounce against move_bounce_all(adv); ? Not sure.


objects

MAIN ACTIONS, SET 1


GUI Action Equivalent GML Commands

Create an instance of an instance_create(x,y,obj);


object

Create an instance of an <var>=instance_create(x,y,obj);


object with a speed and <var>.speed=<expression>;<
direction var>.direction=<expression>;

Create instance of random No direct equivalent in GML.


object

Change the instance instance_change(obj,perf);

Destroy the instance instance_destroy();

Destroy instances at a position_destroy(x,y);


position

Change the sprite sprite_index=<spritename>; image_index=<n>;


image_xscale=<expression>;
Transform the sprite image_yscale=<expression>;
image_angle=<expression>;

Set sprite blending image_blend=<color>;

Play a sound sound_play(index);

Stop a sound sound_stop(index);

If a sound is playing if (sound_isplaying(index))

Go to previous room room_goto_previous();

Go to next room room_goto_next();

Restart the current room room_restart();

Go to a different room room_goto(numb);

If previous room exists if (room_previous(room)!= -1)

If next room exists if (room_next(room)!= -1)

MAIN ACTIONS, SET 2


GUI Action Equivalent GML Commands

alarm[n]= <expression>; where n is a number


Set an alarm clock from 0 to 11.

Sleep for a while sleep(numb);

Display a message show_message(str);

Show the game show_info();


information

Restart the game game_restart();


End the game game_end();

Save the game game_save(string);

Load the game game_load(string);

CONTROL ACTIONS
GUI Action Equivalent GML Commands

If a position is collision free if (place_free(x,y))

If there is a collision at a if (!place_free(x,y))


position

If there is an object at a if (place_meeting(x,y,obj))


position

if
If the number of instances is (instance_number(obj)==<express
a value ion>)

With a change perform next No equivalent action.


action

If the user answers yes to a if (show_question(str))


question

If an expression is true if ((<expression>) == true)

If a mouse button is pressed if (mouse_button != mb_none)

If instance is aligned with grid if (place_snapped(hsnap,vsnap))

Start of block Left curly bracket {

End of block Right curly bracket }

Else else
repeat (<expression>)
Repeat next action <statement>

Exit the current event exit;

Execute a piece of code Simply type in that piece of code.

Comment // Comment line

Set the value of a variable variable= <expression>;

If a variable has a value if (variable == <expression>)

Draw the value of a variable draw_text(x,y,string(variable))

SCORE Actions
GUI Action Equivalent GML Commands

Set the score score=<expression>;

If score has a value if (score == <expression>)

Draw the value of score draw_text(x,y,string(score))

Display the highscore table highscore_show(numb);

Clear the highscore table highscore_clear();

Set the number of lives lives= <expression>;

If lives is a value if (lives == <expression>)

Draw the number of lives draw_text(x,y,string(lives))

Draw the lives as image No simple equivalent.

Set the health health= <expression>;


If health is a value if (health == <expression>)

draw_healthbar( x1, y1, x2, y2, amount,


backcol,
Draw the health bar mincol, maxcol, direction, ahowback,
showborder);

Set the window caption window_set_caption(caption);


information

DRAW ACTIONS
GUI Action Equivalent GML Commands

draw_sprite(sprite,subimg,x,y); and related


Draw a sprite image functions

draw_background(back,x,y); and related


Draw a background image functions

Draw a text draw_text(x,y,string); and related functions

draw_text_transformed( ... ); and related


Draw a text transformed functions

Draw a rectangle draw_rectangle(x1,y1,x2,y2,outline);

Draw a horizontal gradient draw_rectangle_color( ... );

Draw a vertical gradient draw_rectangle_color( ... );

Draw an ellipse draw_ellipse(x1,y1,x2,y2,outline);

Draw a gradient ellipse draw_ellipse_color( ... );

Draw a line draw_line(x1,y1,x2,y2);

Draw an arrow draw_arrow(x1,y1,x2,y2,size);

Set the colors draw_set_color(col); and draw_set_alpha(alpha);


Change fullscreen mode window_set_fullscreen(full);

Take a snapshot image of the screen_save(fname);


game

No simple GML equivalent. Read the GML


Create an effect documentation.

You might also like