Really interesting bug! I’ll start off with the background of what happened and the debugging process in case you want to tell your students, but if you want you can skim to the end.
Usually an error message like this means that you are treating something as a function (calling it), even though it is not one. This can either be because you forgot to define the function, misspelled it, or (most commonly) have redefined your function as something else in a different place in the program.
In this case, it’s a little more tricky. The error is showing up right after the conditional that asks about
Chick1.isTouching(Fence). Even though that’s not a function on its own, the
isTouching method acts like a function when it’s attached to a sprite. When it’s NOT attached to a sprite, though, it doesn’t mean anything.
If you scroll down to line 115, you’ll see that the value of Chick1 is set to
false. That means that it’s not a sprite anymore, so next time the program checks for
isTouching method doesn’t mean anything anymore.
I’m not sure exactly what the students were intending to do in setting the values of their sprites to
destroy them or set their
visible property to
false?), but fixing that should fix the program.