isTouching not working for a student


I have a student that cannot get the isTouching command to work, and hasn’t since the beginning of learning about it. I am not sure why everyone else’s works but his does not. No matter what sprite he puts in first, his computer says it does not recognize the isTouching command. I have attached a couple images for reference. Any help would be greatly appreciated.



Hi Tara!

Thanks for including the error code on the bottom. It looks like the code is trying to use the method isTouching on hero, but hero is not defined. That probably means that this line of code is running before you have created the sprite and stored it into the variable “hero”.


I accidentally posted the same image twice. Here is the other picture and this is at the top of the code:

Without seeing the entire project, it’s hard to know for sure, but it appears that the code in line 45 is getting called before you create the sprite in line 9.