Student project linked above uses the mousepressedover tool in an if statement to score points for good or lose points for bad. The issue is the points are never correct.
How could this work?
Student project linked above uses the mousepressedover tool in an if statement to score points for good or lose points for bad. The issue is the points are never correct.
How could this work?
This Fruit Ninja remake is pretty impressive so far! Since the student used mousePressedOver, the score goes up the entire time the mouse if pressed down over top of the given fruit. If you hang around over top of it, the score counts up very quickly. Same for down. That’s why the score is never correct. I’m not 100% sure how to keep it just to one point. I tried using mouseOver, but that had a similar result. Maybe others have some ideas?
@blanden -
This is a tricky one because, as @edavis said, the points go up for as long as the mouse is pressed over the sprite even when animation changes. So, what you have to do is move the sprite off the screen (I tried to destroy the sprite but the points were still adding). Based on needing to move the sprite, here are the steps that I followed (and by the way - there are probably many other ways to solve this):
score = score + 1; //score 1 point for touching the sprite
chx=cherry.x; //capture the current x postiion
chy=cherry.y; //capture the current y position
replaceFunc(chx, chy); //run a fucntion with these numbers to replace the fruit with other sprite in current x & y
cherry.x=1000; //move the old sprite so no longer scores points
Finally, you’ll need to create the function that replaces the original fruit and send the parameters that are the x and y position of the original fruit.
The cool part is that everything resets because the loopingfruits function replaces the new fruit back to the original. Here is my remix with only the cherry fruit complete.
Again - probably other ways to solve but this remix was my attempt:)
~Michelle