# Unit 3, Lesson 22 - student game has an error

**URL:** <https://forum.code.org/t/unit-3-lesson-22-student-game-has-an-error/26612>\
**Category:** Coding and Debugging Help\
**Created:** [April 29, 2019, 5:58pm UTC](https://forum.code.org/t/unit-3-lesson-22-student-game-has-an-error/26612 "2019-04-29T17:58:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kammie.dill](https://avatars.discourse-cdn.com/v4/letter/k/eb8c5e/32.png) [@kammie.dill](https://forum.code.org/u/kammie.dill)\
**Post date:** [April 29, 2019, 5:58pm UTC](https://forum.code.org/t/unit-3-lesson-22-student-game-has-an-error/26612/1 "2019-04-29T17:58:59Z")

</div>

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:

> **[Check out what I made](https://studio.code.org/projects/gamelab/RaGuD_aVQ_Y_fbC0f-50OVpUT17ujwRc9mvMWE_cIlM)**
>
> I wrote the code myself with Code.org

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?

thanks,  
Kammie

---

<div class="post-metadata">

**Author:** ![elizabeth\_admin](https://avatars.discourse-cdn.com/v4/letter/e/bb73d2/32.png) [@elizabeth\_admin](https://forum.code.org/u/elizabeth_admin)\
**Post date:** [April 29, 2019, 7:07pm UTC](https://forum.code.org/t/unit-3-lesson-22-student-game-has-an-error/26612/2 "2019-04-29T19:07:43Z")

</div>

Hi Kammie,

`isTouching` is a method/function that is automatically there for any sprite. If `frog.isTouching` isn’t a function, that means that `frog` isn’t a sprite anymore. I’d have the student check over the code for somewhere that the `frog` variable was assigned something that is not a sprite, probably because the student meant to assign something to a sprite property, but instead assigned the value to the entire sprite, thus knocking the sprite out of the variable and leaving a new (non-sprite) value there instead.

You could also use watchers to “watch” `frog`. Eventually, it will change from a sprite to something else, and you’l know when the problem shows up.

Elizabeth
