Skip to content

Instantly share code, notes, and snippets.

@PoppyWorks
Last active July 23, 2018 16:58
Show Gist options
  • Save PoppyWorks/49ebe1278e8c454b267dc907df71efd9 to your computer and use it in GitHub Desktop.
Save PoppyWorks/49ebe1278e8c454b267dc907df71efd9 to your computer and use it in GitHub Desktop.
GML script. Will fade the screen to the chosen color. Returns true when done. This can be used to change rooms when it returns. Line 6 can be un-commented to do the fade to color in steps, to simulate old-school style color fading.
///draw_fade_color(color,speed/alplha)
alert(0,"Fading..." + "(" + (string(color_fade_alpha)) +"). Cannot pause game." )
can_pause = false;
depth = -100000
var snapped = color_fade_alpha//= floor(color_fade_alpha * 10)/10
draw_set_colour(argument0)
draw_set_alpha(snapped);
draw_rectangle(0, 0, view_xview [0] + view_wview[0], view_yview[0] + view_hview[0], false);
draw_set_blend_mode_ext(bm_src_colour,bm_zero);
color_fade_alpha += argument1;
draw_set_blend_mode(bm_normal);
draw_set_alpha(1);
if color_fade_alpha >= 1
{
color_fade_alpha = 0
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment