Sprite is stuck when changing directions in X

I have a student creating a space shooter that has a boss. When the boss reaches the right side of the screen, it’s supposed to switch directions & go left, but instead gets stuck. We’ve tried conditionals with the counter pattern, conditionals with velocity, creating edge sprites for it to bounce off of. I am stumped. It keeps getting stuck on the right side of the screen. Any suggestions?

Link to project: Game Lab - Code.org

your issue pertains to how the velocity of the boss is being constantly set and you not dealing with changing the velocity

we can fix this by checking if the velocity is 0 in order to start it from moving
and using bounceOff to automatically deal with velocity reversals when the sprite hits the edges

if (enemyBoss.y > 139) {
    enemyBoss.velocityY = 0;
    if (enemyBoss.velocityX === 0) {
      enemyBoss.velocityX = 3;
    }
    bossLaser.visible = true;
    bossLaser.x = enemyBoss.x;
    bossLaser.velocityY = 20;
    textSize(20);
    fill("orange");
    text("THE MOTHERSHIP: " + bossHealth, 120, 20, 100, 100);
  }
  enemyBoss.bounceOff(rightEdge);
  enemyBoss.bounceOff(leftEdge);
  // if (enemyBoss.isTouching(rightEdge)) {
  //   enemyBoss.x = enemyBoss.x - 3;
  // }
  // if (enemyBoss.isTouching(leftEdge)) {
  //   enemyBoss.x = enemyBoss.x + 3;
  // }

Varrience

YO! It works Varrience! Really appreciate it