I’m a very novice coding teacher, trying to help my students resolve an issue in which the score in only intermittently increasing. The score will only increase when the player sprite is at the bottom edge of the screen. Even then, it only works intermittently.
I’ve tried searching the forums, but nothing I’ve found has helped solve this problem. Thanks in advance for any guidance you can offer.
I don’t know what your exact issue is, but I think you want the score to go up whenever the player touches the falling sprites. It’s a simple fix.
All you have to do is move the collectItems() function below scorePoints(). The reasoning behind this is because collectItems() changes the position of the falling sprites. If it’s before scorePoints(), it’ll move first, which means the player will never actually touch the falling sprites in scorePoints(), therefore no points will be added.
scorePoints(); //scores point if touching, first priority
collectItems(); //moves falling sprite, second priority