Mytchall Bransgrove
Member
Hey guys, am thinking of now on, only using a surface to capture everything on screen, delete all objects I don't need and then fade the surface as an easy way to create a fade or motion transition.
I was previously accessing every objects image_alpha and changing it.
Any reasons not to use this method?
Also this is a good way to share my code if it's a good method:
CREATE:
ALARM[11]:
ALARM[0]:
ALARM[1]:
ALARM[2]:
DRAW:
To call the fade transition I write:
z=instance_create(0,0,obj_surfaceCapture);
z.method='fade';
I was previously accessing every objects image_alpha and changing it.
Any reasons not to use this method?
Also this is a good way to share my code if it's a good method:
CREATE:
Code:
///Create Vars
surfX=0;
surfY=0;
surfA=1;
method='fade';
alarm[11]=1;
my_surf=surface_create(room_width,room_height)
surface_set_target(my_surf); // Sets its target to itself
draw_clear_alpha(c_black, 0); // Clears surface.
with(all)
{
if (visible == true) && !(id==other.id)
{
event_perform(ev_draw,0);
}
}
surface_reset_target();
ALARM[11]:
Code:
///Figure out where you're going
if (method=='fade')
{
alarm[0]=1;
}
if (method=='slideRight')
{
alarm[1]=1;
}
if (method=='slideLeft')
{
alarm[2]=1;
}
ALARM[0]:
Code:
if !(surfA==0)
{
surfA-=0.1;
alarm[0]=1;
}
else {
instance_destroy();
}
ALARM[1]:
Code:
/// Slide Right
if !(surfX>(room_width-5))
{
surfX += ((room_width-surfX)/8)
alarm[1]=1;
}
else {
instance_destroy();
}
ALARM[2]:
Code:
/// Slide Left
if (surfX>(0-room_width+5))
{
surfX -= ((surfX-(-room_width))/5)
alarm[2]=1;
}
else {
instance_destroy();
}
DRAW:
Code:
draw_set_alpha(surfA)
draw_surface(my_surf,surfX,surfY)
draw_set_alpha(1)
To call the fade transition I write:
z=instance_create(0,0,obj_surfaceCapture);
z.method='fade';