Help with Rotating Sprites

I’m trying to program an enemy sprite to go back and forward between two blocks, I have looked at examples from other games and i’m 99% sure its the same code, however, when I run my program the enemy sprite gets to one of the blocks and then moves side to side instantly in the same spot forever. Here is my game and the buggy enemy.

Try changing the shape of the object, squares sometimes catch the corners of square floors, so that may be a possibility.