Legacy GM Day Cycle Problem

Imperial

Member
control Light
Code:
//Create Event
Alpha = 0;
maxAlpha = 1;
globalvar Light;
Light = surface_create(view_wview[view_current],view_hview[view_current]);
alarm[0] = room_speed * 5;

//Alarm[0] Event
if(Alpha < maxAlpha)
{
    Alpha += 0.01;
    alarm[0] = 1;
else
{
    alarm[1] = room_speed * 5;
}

//Alarm[1] Event
if(Alpha > 0)
{
    Alpha -= 0.01;
    alarm[1] = 1;
}
else
{
    alarm[0] = 1;
}

//Step Event
surface_set_target(Light);
draw_set_color(c_ltgray);
draw_set_alpha(Alpha);
draw_rectangle(0,0,view_wview[view_current],view_hview[view_current],false);
draw_set_alpha(1);
surface_reset_target();

//Draw Event
if surface_exists(Light)
{
    draw_set_blend_mode(bm_subtract);
    draw_surface(Light,view_xview[view_current],view_yview[view_current]);
    draw_set_blend_mode(bm_normal);
}
else
{
    Light = surface_create(view_wview[view_current],view_hview[view_current]);
}
but It don't work
 
A

Aura

Guest
Define "didn't work". Apart from that a couple of issues with your code, plus it has some bad habits:

  • In the Create event, you're using view_wview[view_current] for the height of the surface. It should have been view_hview[view_current] instead.
  • You should do all the drawing in the Draw event.
  • Clear the surface before drawing the rectangle every step with the help of draw_clear_alpha(c_black, 0). (Very Important!)
 
Top