GameMaker Enemy change direction

Hi everyone!
I could use some help with my enemy state machine.
When it hits the "follow" state it goes towards the player.
But how can I make it not to run over a block?
This is the code I tried, but a lot of time it gets stuck or runs over the block.
Can anyone take a look and help me?
Thanks a bunch.

GML:
    case "ffollow":
            {
                if(place_empty(x,y,obj_bloco))
                    {
                    image_blend = c_red;
                    if(!instance_place(x,y,obj_bloco))
                        {
                    direction = point_direction(x,y,jogador.x,jogador.y);
                        }
                    else
                        {
                            direction = point_direction(x,y,jogador.x,jogador.y) + 45 ;
                        }
                    contador = 0;
                    speed = 2;
                    }
                else
                    {
                        speed = 0;
                    }
 
Top