Help with a student project

My students are working on their final projects for Unit 3. This student is writing a game similar to flappy bird. Once the score reaches 20 it will not go higher and we cannot figure out why. Any ideas??


Hi Michelle,

Right now, I can’t get that far in the game anyway. If I were to guess, I’d say that it’s because you’re triggering a score increase by checking to see whether the x-coordinates of the player and the ice are exactly the same, but when the ice gets faster, it “skips” the location that would make it trigger the score increase.

Right now, the ice starts at 405, so when it goes at a velocity of -2, it skips the even numbers, but always gets to 75. When it goes at a velocity of -3, it skips the numbers that are not divisible by 3, but always hits 75 (405, 402, 399… 78, 75, 72…). When it goes at a velocity of -4, it hits 405, 401, 307… 81, 77, 73, … and never actually hits 75.

You could change this by changing the coordinates so that it always hits the x-coordinate of the player, or by changing the way that the score is triggered. It’s a nice point to hit with the kids that while velocity appears to be continuous because it’s going so fast, we are really just using the counter pattern, so some locations get skipped in the process.


1 Like

Thank you @elizabeth_admin for the explanation. That makes a LOT of sense. I’m learning a lot about javascript right along with my students this semester. :grinning:

1 Like