Desperate for Help With Student Project!


I need another pair of eyes on this - just can’t figure out why when we click on an orange it adds more than one to the clicks variable and then her basket pops up too soon. Help me please!!



Seems to me, not knowing the full intent of the project, that the variable continues to increase rapidly when over the orange and clicked. I added a console log block and one click on an orange put the click variable at 3 and 4, which would cause issues with the basket popping up when click variable reaches 5. You could have the orange disappear on a click and then if all the oranges = false then the basket would appear.

Hope that helps!


Thanks so much for the response. I will give her this suggestion tomorrow. We had the console log on there and could see the problem, we’re just confused because she used this program given as an example from as the inspiration for her project. It seems like hers is set up the exact same way but isn’t working…it’s just driving us crazy. Something simple we’re missing, I’m sure?


Another way to do it would be to move the orange out of the way once the mouse is pressed over it. Like move it off of the screen so the next time through the draw loop, the mouse could not be pressed over it and thus the counter would not increase beyond one per “click”.

 if (mousePressedOver(orange1)) {
    click = click + 1;
    orange1.visible = false;
//move that orange!
    orange1.x = -300 ;


Yeah, the flowers get moved to the vase when they are clicked, which is why it’s not as much of a problem for the flower exemplar. You can get a funny bug, though, if you move one flower over, then start clicking where you know it’s going to be.