As you put in more levels in your maze games, it's great to have more challenges and dangers for the player to avoid.  Monsters that kill the player are an easy way to do this. 

Let's say we have a monster that we want to pace backwards and forwards.  How do we make it turn around after a certain distance and how do we make the sprite change from facing right to facing left and back again?

We will need left and right facing sprites, and we will place an invisible block each end where we want the monster to turn around. 

Add in 2 sprites, one facing left and the other facing right.  I will use sprMonsterLeft and sprMonsterRight.  I will get the sprites from the Pacman folder.

Add in another sprite for the block.  sprBlock

Make a monster object, objMonster, and a block object, objBlock.  Attach the right facing sprite to the monster as it will move that way to start with.

Place the monster in a room, and put a block each end of where it will move.

Add a create event for objMonster.  Add in a Start Moving action, and make it start moving to the right.
Add a collision event for objMonster colliding with the block.

Change the horizontal direction.

We also need to reverse the direction of the sprite.  After it collides with the block, we will test which way it is moving by using its horizontal speed variable, hspeed.  If hspeed is greater than zero, it must be moving to the right, otherwise if its hspeed is less than zero it is moving to the left.

So add in the following actions:

Using Paths

Paths are another way of doing the same thing, but without using collisions with blocks to turn the monster around.

Look up Paths under the GameMaker Help menu.