if (tempEnemy.x < 0) { tempEnemy.rotation = -45; } if (tempEnemy.x > stage.stageWidth) { tempEnemy.rotation = 45; }