#### mentalredux

##### Member

GML:

```
if distance_to_point (mouse_x,mouse_y)>200{speed=10};
else
if distance_to_point (mouse_x,mouse_y)>170{speed=8};
else
if distance_to_point (mouse_x,mouse_y)>150{speed=7};
else
if distance_to_point (mouse_x,mouse_y)>50{speed=4};
else
if distance_to_point (mouse_x,mouse_y)>25{speed=3};
else
if distance_to_point (mouse_x,mouse_y)>5{speed=2};
else
if distance_to_point (mouse_x,mouse_y)>3{speed=1};
else
if distance_to_point (mouse_x,mouse_y)<1{speed=0};
```

GML:

```
//H
if(place_meeting(x + speed, y, objWall))
{
while(!place_meeting(x + sign(speed), y, objWall))
{
x += sign(speed);
}
speed = 0;
}
x += speed;
//V
if(place_meeting(x, y + speed, objWall))
{
while(!place_meeting(x, y + sign(speed), objWall))
{
y += sign(speed);
}
speed = 0;
}
```