M

#### maxta12

##### Guest

Code:

```
draw_self()
//set temp vars
var xleftscan = false;
var xrightscan = false;
var yupscan = false;
var ydownscan = false;
var xleftscan2 = false;
var xrightscan2 = false;
if first_open = false
{
//upscan
//start by dealing with the width of the line
//left x stretch
for (i=0;i<500;i+=1)//i can be considered the max the line will extend
{
if !collision_line(x,y+line1_y,x-i,y+line1_y,wall,1,1)
{
xleftscan = true
surface_set_target(obj_view_region.view_surface)
draw_set_blend_mode(bm_subtract)
draw_line(x,y+line1_y,x-i,y+line1_y)
draw_set_blend_mode(bm_normal)
surface_reset_target()
}
else
{
xleftscan = false
}
//right x stretch
if !collision_line(x,y+line1_y,x+i,y+line1_y,wall,1,1)
{
xrightscan = true
surface_set_target(obj_view_region.view_surface)
draw_set_blend_mode(bm_subtract)
draw_line(x,y+line1_y,x+i,y+line1_y)
draw_set_blend_mode(bm_normal)
surface_reset_target()
}
else
{
xrightscan = false
}
}
//1.check that both sides have been maxed out on the x axis
//2.move up on the y axis
if xleftscan = false
{
if xrightscan = false
{
if !collision_line(x,y,x,y+line1_y+1,wall_horizontal,1,1)
{
yupscan = true
line1_y += 1
}
else
{
yupscan = false
}
}
}
//downscan
//start by dealing with the width of the line
//left x stretch
for (ii=0;ii<500;ii+=1)//i can be considered the max the line will extend
{
if !collision_line(x,y+line2_y,x-ii,y+line2_y,wall,1,1)
{
xleftscan2 = true
surface_set_target(obj_view_region.view_surface)
draw_set_blend_mode(bm_subtract)
draw_line(x,y+line2_y,x-ii,y+line2_y)
draw_set_blend_mode(bm_normal)
surface_reset_target()
}
else
{
xleftscan2 = false
}
//right x stretch
if !collision_line(x,y+line2_y,x+ii,y+line2_y,wall,1,1)
{
xrightscan2 = true
surface_set_target(obj_view_region.view_surface)
draw_set_blend_mode(bm_subtract)
draw_line(x,y+line2_y,x+ii,y+line2_y)
draw_set_blend_mode(bm_normal)
surface_reset_target()
}
else
{
xrightscan2 = false
}
}
//1.check that both sides have been maxed out on the x axis
//2.move down on the y axis
if xleftscan2 = false
{
if xrightscan2 = false
{
if !collision_line(x,y,x,y+line2_y-1,wall_horizontal,1,1)
{
ydownscan = true
line2_y -= 1
}
else
{
ydownscan = false
}
}
}
}
```

Code:

```
line1_y = 0
line2_y = 0
first_open = true
```