My student created a game that works like the old Frogger game. When he runs the game, he gets an error. I have looked over this code and can’t figure out why the error occurs.
Here is a link to his project:
You move the frog using the error keys. You are supposed to avoid the space ships and move the frog all the way to the top of the screen. When you collide with a ship, the lives go down and the frog is placed at the starting point.
The error happens when the frog hits the first ship.
ERROR: Line: 116: TypeError: frog.isTouching is not a function
All the other code using the frog sprite seems to work. I couldn’t see any reason why the frog.isTouching call would not work. In the end, I deleted the entire function that he was using and created a new one. I put the same code in the new function and it worked.
Can anyone see an error in this student’s code?