Here is one of my student’s projects
We get lots of random errors like this about different pieces of code not being functions. ERROR: Line: 22: TypeError: frog.isTouching is not a function.
I am not sure why were are getting function errors. I am trying to figure out what is causing them and make them go away.
I’ve tried this game in game lab. I’ve tried remixing it. I’ve tried deleting the code and putting it back in. What am I missing?
It looks like in line 36 you assign fly a random number. Probably you meant fly.x or fly.y When you do that it makes fly a variable instead of a sprite. The error on line 26 happens when it is run the next time through the loop and tries to check for a number and a sprite touching, which it can’t.
Also look at line 46 where you assign frog a number.
I think if you fix those two things you will stop getting those errors and things will run as you want.
Hope this helps and if you have any more questions, please let us know.
Thank you. That fixed it. I’ve been looking at too many lines of code.