Student Assistance on Game

Student is having trouble with his car animation and movement. He wants the cars to reset when they get to y=0. Additionally, they the player will get a score when the first car reaches y=0.

I believe the exercise with the bunny moving on this unit should give ideas on how to implement this.
In pseudocode
if (car.y <=0) score += 1
car.y = 450 // that should reset the car to the bottom of the road :wink:
Since this can be either car, maybe this can be in a function checkCarPosition(car). You call it with both yellow and red car each.


Yes, I agree with @mmathews for resetting the cars and setting the score.

One other thing that was something you might fix in the game was the car trailing/shadows. If you reset the strip.y (road) back to 0 when it’s position > 400, then the cars will not appear to have shadows or trails behind them (if you wish;)

Let us know if you have issues with these suggestions,

Thank you both for your help!