D&D to GML

Here is a conversion of the drag and drop options in Game Maker to their Game Maker Language equivalent.

Move

move-fixed.png Move Fixed
move_fixed( direction, speed );
move-free.png Move Free
motion_set(direction,speed);
move-towards.png Move Towards
move_towards_point(x,y,speed);
speed-horizontal.png Speed Horizontal
hspeed = speed;
speed-vertical.png Speed Vertical
vspeed = speed;
set-gravity.png Set Gravity
gravity_direction = direction; 
gravity = amount;
reverse-horizontal.png 'Reverse Horizontal'
hspeed = -hspeed;
reverse-vertical.png 'Reverse Vertical'
vspeed = -vspeed;
set-friction.png 'Set Friction'
friction = amount;
jump-to-position.png 'Jump to Position'
x = value;
y = value;
jump-to-start.png 'Jump to Start'
x = xstart;
y = ystart;
jump-to-random.png 'Jump to Random'
move_random(1,1);
align-to-grid.png 'Align to grid'
move_snap(hsnap,vsnap);
wrap-screen.png 'Wrap Screen'
move_wrap(hort,vert,margin);
move-to-contact.png 'Move to Contact'
move_contact_solid(dir,maxdist);
move_contact_all(dir,maxdist);
bounce.png 'Bounce'
move_bounce_solid(advanced);
move_bounce_all(advanced);
set-path.png 'Set Path'
path_start(path,speed,endaction,absolute);
end-path.png 'End Path'
path_end();
path-position.png 'Path Position'
path_position = value;
path-speed.png 'Path Speed'
path_speed = value;
step-towards.png 'Step Towards'
mp_linear_step(x,y,stepsize,checkall);
step-avoiding.png 'Step Avoiding'
mp_potential_step(x,y,stepsize,checkall);

Main1

create-instance.png 'Create Instance'
instance_create(x,y,object0);
create-moving.png 'Create Moving'
ID = instance_create(x,y,object1);
with (ID) motion_set(direction,speed);
create-random.png 'Create Random'
instance_create(x,y,choose(object0,object1,object2,...));
change-instance.png 'Change Instance'
instance_change(obj,perf);
destroy-instance.png 'Destroy Instance'
instance_destroy();
destroy-at-position.png 'Destroy at Position'
position_destroy(x,y);
change-sprite.png 'Change Sprite'
sprite_index = sprite0;
transform-sprite.png 'Transform Sprite'
image_xscale = value;
image_yscale = value;
image_angle = value;
image_xscale = -image_xscale;
image_yscale = -image_yscale;
color-sprite.png 'Color Sprite'
image_blend = color;
image_alpha = value;
play-sound.png 'Play Sound'
sound_play(sound);
sound_loop(sound);
stop-sound.png 'Stop Sound'
sound_stop(index);
check-sound.png 'Check Sound'
if sound_isplaying(sound1) = true 
{
  sound_stop(sound1)
}
else
{
  if sound_isplaying(sound2)
{
    sound_stop(sound2)
 }
}
transition kind = value;
previous-room.png 'Previous Room'
room_goto_previous();
next-room.png 'Next Room'
room_goto_next();
restart-room.png 'Restart Room'
room_restart();
different-room.png 'Different Room'
room_goto(room);
check-previous.png 'Check Previous'
if room_previous(room) != -1 
{
  room_goto_previous();
}
check-next.png 'Check Next'
if room_next(room) != -1 
{
  room_goto_next();
}

Main2

set-alarm.png 'Set Alarm'
alarm[0] = value;
sleep.png 'Sleep'
sleep(numb);
set-time-line.png 'Set Timeline'
timeline_index = timeline;
time-line-position.png 'Set Timeline Position'
timeline_position = value;
display-message.png 'Display Message'
show_message('Hello');
show-info.png 'Show Info'
show_info();
show-video.png 'Show Video'
show_video(fname,full,loop);
restart-game.png 'Restart Game'
game_restart();
end-game.png 'End Game'
game_end();
save-game.png 'Save Game'
game_save(fname);
load-game.png 'Load Game'
game_load(fname);
replace-sprite.png 'Replace Sprite'
sprite_replace(ind,fname,imgnumb,precise,transparent,smooth,preload,xorig,yorig);
replace-sound.png 'Replace Sound'
sound_replace(index,fname,kind,loadonuse);

/kind: 0-normal, 1-background, 2-3d, 3-mmplayer
replace-background.png 'Replace Background'
background_replace(ind,fname,transparent,smooth,preload);

Control

check-empty.png 'Check Empty'
if place_free(x+4,y) { /actions here. } 
{
  x += 4;
}
/Can also be "not" place_free: if !place_free(x+4,y)
check-collision.png 'Check Collision'
if place_meeting(x,y,object) { /actions here. }
if collision_point(x,y,obj,prec,notme) { /actions here. }
if collision_rectangle(x1,y1,x2,y2,obj,prec,notme) { /actions here. }
if collision_circle(xc,yc,radius,obj,prec,notme) { /actions here. }
if collision_ellipse(x1,y1,x2,y2,obj,prec,notme) { /actions here. }
if collision_line(x1,y1,x2,y2,obj,prec,notme) { /actions here. }
check-object.png 'Check Object'
if place_meeting(x,y,object0) { /actions here. }
test-instance-count.png 'Test Instance Count'
if instance_number(obj) = value { /actions here. }
test-chance.png 'Test chance'
if floor(random(value)) = 0 { /actions here. }

/value represents sides of dice
check-question.png 'Check Question'
if show_question('Do you want to do this?') { / actions here. }
test-expression.png 'Test Expression'
if (expression) { / actions here. }

/Examples for expression would be: x = 5, y > 10, global.item = 'Key'.
check-mouse.png 'Check Mouse'
if mouse_check_button(mb_left)
{
  if cursor_sprite=sprLineS
  {
    instance_create(mouse_x,mouse_y,objLineS);
  }
  else if cursor_sprite=sprLineM
  {
    instance_create(mouse_x,mouse_y,objLineM);
  }
  else if cursor_sprite=sprLineL
  {
    instance_create(mouse_x,mouse_y,objLineL);
  }
}

/Buttons can be: mb_none,mb_left, mb_middle, or mb_right.
check-grid.png 'Check Grid'
if place_snapped(value,value) { /actions here. }
start-block.png 'Start Block'
GML uses brackets "{" for blocks of commands.
end-block.png 'End Block'
GML uses brackets "}" for blocks of commands.
else.png 'Else'
if x = 50
{
  hspeed = 2;
  vspeed = -2;
}
else
{
  motion_set(90,1);
}

/When value of the test is false (x != 50), commands under "else" are executed.
exit-event.png 'Exit Event'
exit;
repeat.png 'Repeat'
repeat (value) { /actions here. };

/Example: repeat (10) instance_create(x,y,object0); creates 10 object0 at x,y
call-parent-event.png 'Call Parent Event'
event_inherited();
execute-code.png 'Execute Code'
-no code available in GML-
execute-script.png 'Execute Script'
script_execute(ind,arguments);
comment.png 'Comment'
GML uses 2 slashes "//" for a comment.
set-variable.png 'Set Variable'
use "=" operator to assign to a variable.

Examples:

health = 50;
lives = 3;
name = 'Gordon';

/Use 'global.' for your own variables that are to be used by more than one object...
global.name = 'Gordon';

/You do not need to use global for built-in variables like 'lives', or 'score'.
test-variable.png 'Test Variable'
/Use an if statement to check this. Example:

if lives = 0 { /actions here. }
draw-variable.png 'Draw Variable'
draw_text(x,y,variable);

/Use "+" to draw more variables in one line: draw_text(x,y,varible1 + ',' + variable2 + ...)

Score

set-score.png 'Set Score'
score = value;
test-score.png 'Test Score'
if score = value { /actions here. }
draw-score.png 'Draw Score'
draw_text(x,y,'Score: ' + string(score));
show-highscore.png 'Show Highscore'
highscore_set_background(back);
highscore_set_border(show);
highscore_set_colors(back,new,other);
highscore_set_font(name,size,style);
highscore_show(numb);
clear-highscore.png 'Clear Highscore'
highscore_clear();
set-lives.png 'Set Lives'
lives = value;
test-lives.png 'Test Lives'
if lives = value { /actions here. }
draw-lives.png 'Draw Lives'
draw_text(x,y,'Lives: ' + string(lives));
draw-life-images.png 'Draw Life Images'
var a;
a = 0;
repeat(lives)
{
  draw_sprite(sprite0,0,view_xview+a,view_yview);a += sprite0.sprite_width;
}
set-health.png 'Set Health'
health = value;
test-health.png 'Test Health'
if health = value { /actions here. }
draw-health.png 'Draw Health'
draw_healthbar(x1,y1,x2,y2,amount,backcol,mincol,maxcol,direction,showback,showborder);
score-caption.png 'Score Caption'
show_score = value;
caption_score = string;
show_lives = value;
caption_lives = string;
show_health = value;
caption_health = string;

Extra

create-part-system.png 'Create Part System'
index=part_system_create();
destroy-part-system.png 'Destroy Part System'
part_system_destroy(index);
clear-part-system.png 'Clear Part system'
part_system_clear(index);
create-particle.png 'Create Particle'
index = part_type_create();
part_type_shape(index,shape);
part_type_size(index,size_min,size_max,size_incr,size_rand);
part_type_color(index,color_start,color_middle,color_end);
particle-color.png 'Particle Color'
part_type_color1(ind,color1);
part_type_color2(ind,color1,color2);
part_type_color3(ind,color1,color2,color3);
part_type_color_mix(ind,color1,color2);  or...
part_type_color_rgb(ind,rmin,rmax,gmin,gmax,bmin,bmax);  or...
part_type_color_hsv(ind,hmin,hmax,smin,smax,vmin,vmax);
particle-life.png 'Particle Life'
part_type_life(index,life_min,life_max);
particle-speed.png 'Particle Speed'
part_type_speed(index,speed_min,speed_max,speed_incr,speed_rand);
part_type_direction(index,dir_min,dir_max,dir_incr,dir_rand);
particle-gravity.png 'Particle Gravity'
part_type_gravity(index,grav_amount,grav_dir);
particle-secondary.png 'Particle Secondary'
part_type_death(index,death_number,death_type);
create-emitter.png 'Create Emitter'
index=part_emitter_create(ps);
part_emitter_region(ps,index,xmin,xmax,ymin,ymax,shape,distribution);
destroy-emitter.png 'Destroy Emitter'
part_emitter_destroy_all(ps);
burst-from-emitter.png 'Burst from Emitter
part_emitter_burst(ps,index,parttype,number);
stream-from-emitter.png 'Stream from Emitter'
part_emitter_stream(ps,index,parttype,number);

You must call the function cd_init() before calling other Cd functions.

play-cd.png 'Play CD'
cd_play(first,last);
stop-cd.png 'Stop CD'
cd_stop();
pause-cd.png 'Pause CD'
cd_pause();
resume-cd.png 'Resume CD'
cd_resume();
check-cd.png 'Check CD'
if cd_present() = true { /actions here. }
check-cd-playing.png 'Check CD playing'
if cd_playing() = true { /actions here. }
set-cursor.png 'Set Cursor'
window_set_cursor(curs);
cursor_sprite=sprite0;
open-webpage.png 'Open a Web Page'
execute_shell('http//www.somepage.com',0);

Draw

draw-sprite.png 'Draw Sprite'
draw_sprite(sprite,subimage,x,y);
draw-background.png 'Draw Background'
draw_background(back,x,y);
draw_background_tiled(back,x,y);
draw-text.png 'Draw Text'
draw_text(x,y,string);
draw-scaled-text.png 'Draw Scaled Text'
draw_text_transformed(x,y,string,xscale,yscale,angle);
draw-rectangle.png 'Draw Rectangle'
draw_rectangle(x1,y1,x2,y2,outline); 

/Outline is 1 or 0 for yes or no.
horizontal-gradient.png 'Horizontal Gradient'
draw_rectangle_color(x1,y1,x2,y2,col1,col2,col3,col4,outline);
vertical-gradient.png 'Vertical Gradient'
draw_rectangle_color(x1,y1,x2,y2,col1,col2,col3,col4,outline);
draw-ellipse.png 'Draw Ellipse'
draw_ellipse(x1,y1,x2,y2,outline);
gradient-ellipse.png 'Gradient Ellipse'
draw_ellipse_color(x1,y1,x2,y2,col1,col2,outline);
draw-line.png 'Draw Line'
draw_line(x1,y1,x2,y2);
draw-arrow.png 'Draw Arrow'
draw_arrow(x1,y1,x2,y2,size);
set-color.png 'Set Color'
draw_set_color(col);
set-font.png 'Set Font'
draw_set_font(font);
draw_set_halign(halign);
draw_set_valign(valign);

/halign and valign : 0 for left/top, 1 for center, 2 for right/bottom
set-full-screen.png 'Set Full Screen'
window_set_fullscreen(full);
take-snapshot.png 'Take Snapshot'
screen_save(filename);
create-effect.png 'Create Effect'
effect_create_below(efkind,x,y,size,color);
effect_create_above(efkind,x,y,size,color);

various effects:
ef_explosion, ef_ring, ef_ellipse, ef_firework, ef_smoke, ef_smokeup, ef_star, ef_spark,
ef_flare, ef_cloud, ef_rain, ef_snow

Formula for destroying an object hitting only the top of it:

if (vspeed > 0 and y < other.y + other.sprite_height)
{
  with(other) instance_destroy();
}