/// Draw End Event
// Find the area to reflect by finding the room coordinate of the bottom of the view and subtracting the room coordinate of the waterline.
var reflect_height = (camera_get_view_y(view_camera[0]) + camera_get_view_height(view_camera[0])) - y;
var reflect_width = camera_get_view_width(view_camera[0]);
// Create a surface or recreate the surface.
if (!surface_exists(srf_reflection)) srf_reflection = surface_create(reflect_width, reflect_height);
// Get the screen coordinate of the waterline.
var reflect_y = y - camera_get_view_y(view_camera[0]);
// Copy the area from above the waterline onto the surface.
surface_copy_part(srf_reflection, 0, 0, application_surface, 0, reflect_y - reflect_height, reflect_width, reflect_height);
// Invert and draw the surface at the x room coordinate of the camera and the y room coordinate of the waterline.
// I'm not sure how the scaling works exactly, you might need to use the room y coordinate of the bottom of the camera instead, or you might not.
draw_surface_ext(srf_reflection, camera_get_view_x(view_camera[0]), y, 1, -1, 0, water_color, water_opacity);