"Now it’s time to add enemies to the game, and such enemies must be able to patrol the platform they are placed on. Enemies too will be created as an extension to Sprite class, so the only difficult thing will be making them move on their platform without falling down."
Drop Wizard - Patrolling Enemies
Create an HTML5 game like “Drop Wizard” with Phaser – patrolling enemies