I'm taking a refresher course on C, SQL, etc and an introductory assignment has us using Scratch, which I'm unfamiliar with. In short, I'm making a "game" where a bat semi-randomly bounces around the screen, bouncing off balls which can be moved by clicking them, and trying to get to an apple. When the bat and the apple make contact (i.e. for my purposes, when bat's distance from apple < 50) the bat does its victory "animation". In addition, I have the apple coded to switch costumes to a half-eaten version when its distance from the bat < 50. However, the apple doesn't do this even though the bat's procedures run correctly. Even more strangely, if I re-run the program once it's finished, the apple may start out in its half-eaten costume.
I have tried:
If I'm not mistaken there's no way to switch to an "advanced" mode on Scratch, where I could see the code under the hood; otherwise I'd feel more comfortable sussing out the problem from there per my previous experience. Please let me know if there is such a function I'm missing though, because I may well be able to figure out the problem that way. Thanks!
Your apple code only runs once when you click the green flag. You have to have it running in a loop, continuously checking its distance, in order to have it be updated (preferably pausing in-between each loop iteration so it's not checking too frequently). The reason the apple sometimes starts as half-eaten is because it happened to be < 50 units away from the bat at the moment the flag was clicked.