Link to the project or level: https://studio.code.org/s/csd3-2019/stage/18/puzzle/16?section_id=2279401&user_id=52845566
**What I expect to happen:**error says istounching is not a function
**What actually happens:**nothing error
What I’ve tried: replacing the code and refreshed no chnage
@lorien_cafarella Thank you for all the information, but the link you provided just takes me to the level in Code Studio. You’ll need to provide the Share link in order for the actual code to show up.
I am assuming that you want the setCoin function to reset the coin to the top of the screen if it falls off the screen or if the bunny touches it. So, I would just use the setCoin to only reset the location of the coin and drop it again.
function setCoin(){
coin.y = 0;
coin.x = randomNumber(400, 0);
coin.velocityY = 3;
}
Then, up in the draw function, check if the bunny is touching the coin. If it is, you can call the setCoin function again. I would do this after you check if coin.y > 400.
if (bunny.isTouching(coin)) {
setCoin();
}
The reason for the error is that you run the setCoin procedure before you define the bunny. Try moving the setCoin block inside the draw loop after you have created the bunny and set the bunny Animation.
Best wishes!
Mike