Using % in Game Lab


I have a student who is diving deep into her interactive card and she has me stumped! Can anyone offer help?

Does the % code work in gamelab? We are not sure if there is a bug in the code or if it is outside the scope of gamelab. I have included her description of the problem below:

I have a variable titled "time" that gets updated in this draw loop (time = time + 1;), and I want the sprite to change when the "time" variable is divisible by 5, using %.

if (time%5===0 && fire1.setAnimation("fire")) {



text("wow", 10, 390);


if (time%5 ===0 && fire1.setAnimation("fire2")) {





Can you click the share link and paste the URL to the project here?

Also, what is the bug that she is experiencing?


I’m not sure that I fully understand the bug, other than it did not work as she hoped. She said that she doesn’t think the % command works in game lab, but I am not familiar with what the % command does in javascript. I think she ended up working around it, so I do not believe this section of code is in her current program.


Hi Sean,

The % operator does work in Game Lab, but it looks like she is trying to use the setAnimation method as a Boolean, which does not work. setAnimation will change a sprite’s animation, not return true or false depending on what its animation is.