.isTouching not working

I expect .isTouching to run when the bunny touches the coin. I’m getting an error saying it is because it is only for sprites, when both my bunny and coin are sprites.

1 Like


If you follow the program step by step, it first creates the coin sprite, then calls the function setCoin. That function checks to see whether the bunny is touching the coin, but the bunny has not been created yet. You can’t call a function that uses the bunny sprite before you create the bunny sprite. If you move the function call down to after the bunny is created, I think your program will work.


1 Like