I'm having some problems with my Draw events.
Right now I'm using a custom transition, where two surfaces are drawn in the draw event and moved. After this transition is complete, it returns to the game in the new room. This works fine.
I have recently succeeded in making a brightness system using blend modes, where I add/subtract colors in the Draw event. This also works fine.
The object i use for the brightness system is deactivated during the transition, and the brightness system is incorporated into the transition object instead. Herein lies the problem.
The problem is a single frame in the transition between the two (after the transition, initiation of the room). Either the brightness system triggers twice (once atop of the previous image already brightened), or the objects in the room will lack the brightness system for that one frame (where the objects are drawn over the last transition frame that uses brightness).
After moving the different actions around, I've come to the conclusion, that I need to be able to redraw the image after clearing it. To this effect, I use draw_clear, then screen_redraw. However, because this is in the middle of a draw event, it results in a very visible clearing of the screen right before the frame.
Here is the code i use. I've truncated it down to the essential overlap. The transition object is a loop that ends with clearing the surfaces, not doing brightness for the final step, and initiating the normal screen object. It is this frame that is problematic.
Version 1: background working correct, but with objects missing brightness:
CODE
Transition Object:
(rest of transition)
surface_free(s1)
surface_free(s2)
instance_destroy()
instance_activate_object(ScreenController)
ScreenController.nodraw = 1
exit
ScreenObject:
if nodraw = 1
{nodraw = 0
instance_activate_all()}
else
(rest of non-transition)
(rest of transition)
surface_free(s1)
surface_free(s2)
instance_destroy()
instance_activate_object(ScreenController)
ScreenController.nodraw = 1
exit
ScreenObject:
if nodraw = 1
{nodraw = 0
instance_activate_all()}
else
(rest of non-transition)
Version 2: objects working, but with background getting double-brightness:
CODE
Transition Object:
(rest of transition)
surface_free(s1)
surface_free(s2)
instance_destroy()
instance_activate_all()
ScreenController.nodraw = 1
exit
ScreenObject:
if nodraw = 1
{nodraw = 0}
else
(rest of non-transition)
(rest of transition)
surface_free(s1)
surface_free(s2)
instance_destroy()
instance_activate_all()
ScreenController.nodraw = 1
exit
ScreenObject:
if nodraw = 1
{nodraw = 0}
else
(rest of non-transition)
Version 3: Both objects and background works, but black flash before frame.
CODE
Transition Object:
(rest of transition)
surface_free(s1)
surface_free(s2)
instance_destroy()
instance_activate_all()
ScreenController.nodraw = 1
draw_clear_alpha(c_black,0)
screen_redraw()
exit
ScreenObject:
if nodraw = 1
{nodraw = 0}
else
(rest of non-transition)
(rest of transition)
surface_free(s1)
surface_free(s2)
instance_destroy()
instance_activate_all()
ScreenController.nodraw = 1
draw_clear_alpha(c_black,0)
screen_redraw()
exit
ScreenObject:
if nodraw = 1
{nodraw = 0}
else
(rest of non-transition)
Any solution for this? Is this really extraordinarily simple? I want to use the last one, but I really want to get rid of that annoying flash.
