Hi, I am working on my game and was wondering how to give points when an object is clicked by the mouse/cursor.
Greenfoot.mouseClicked(this); //this is if you put it in the object that's to be clicked on Greenfoot.mouseClicked(Object obj); //this is if you put it elsewhere (such as in the world class). over here my class is named object but that's arbitrary.
true; // or false;
if (Greenfoot.mouseClicked(this)) { << increment score here >> }
if(Greenfoot.mouseClicked(this)) {1}
if(Greenfoot.mouseClicked(this)) {<<1>>}
if (Greenfoot.mouseClicked(this)) { score++; }
((MyWorld)getWorld()).getScore().add(1);