I really need some help with an enemy that I'm working on.

The enemy hides under a hat, similar to a mettaur from Megaman.
Then, when the player is within range, he should stretch himself to block off the player.
So he draws a stretched body, then draws the hat on the end.

Here's a two second mockup, thanks to MS Paint. The green square being the player and the arrow being the mettaur. The tip would be the hat.
As you can see from the picture, I want him to be able to sit on multiple surfaces (walls, ceilings, floors).
//Create Event
hitPoints = 20;
canGetHurt = false;
UP = 10;
DOWN = 11;
RIGHT = 12;
LEFT = 13;
facing = UP;
//facing up
if (place_meeting(x, y + 1, oSolid)) {
image_angle = 0;
facing = UP;
}
//Facing right
if (place_meeting(x - 1, y, oSolid)) {
image_angle = 270;
x -= 1;
facing = RIGHT;
}
//Facing left
if (place_meeting(x + 1, y, oSolid)) {
image_angle = 90;
facing = LEFT;
}
//Facing down
if (place_meeting(x, y - 1, oSolid)) {
image_angle = 180;
y += sprite_height - 1;
facing = DOWN;
}
IDLE = 20;
ALERT = 21;
state = IDLE;
So again, he needs to stretch a sprite of his body from his origin to the player's position, then draw the hat on the end.
It probably isn't too complicated, but I haven't slept and have been running into issues...
