I have a student who created this code in Game Lab in one of the Free Play. Everything in the code looks like it should work but for some reason it isn’t working.
What is it supposed to be doing that is not working?
Sorry about not clarifying enough. The player is supposed to stop at the soil level. Its going to be a mining game.
Your student wants the player to bounce off the top level of blocks. This code
while(counter1 < blockList.length) {
player.bounceOff(blockList[counter1]);
counter1 += 1;
}
runs as soon as the game starts and counter1
is equal to the length of blockList
. counter1
is never set to zero so it never tries to bounce again.