Is it the programmed code or a bug? Help, please


#1

greenFIshL and flashyFIshDL are not functioning properly. I’ve checked the var code and the loop function.

Any ideas before I report it as a bug?

Thank you.

My students are trying to get their games functioning for an Adventure Race station on 04/28.


#2

Ask the student to walk through the logic in the fish looping functions, specifically starting at line 166. If they really read through the code and talk it through aloud I bet they find the bug.

function loopGreenFishL () {
  if (greenFishL.x < 0 ) {
   greenFishL.x = 400;
   greenFishL.velocityX = greenFishL.velocityX +1;
  }
}
function loopGreenFishR () {
  if (greenFishR.x > 400 ) {
   greenFishL.x = 0;
  }
}