Hi guys!
I'm a beginner in programmation and that's a pretty dumb question but I don't understand how to use the Greenfoot.mousePressed command.
Like what do I have to put in the brackets? I know that I have to put the object but how do I write it?
Here I just want to move it whenever I click on it but it won't do anything.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class pionBlanc here. * * @author (your name) * @version (a version number or a date) */ public class pionBlanc extends Actor { /** * Act - do whatever the pionBlanc wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { GreenfootImage image = new GreenfootImage("pionBlanc.png"); image.scale(35, 55); setImage(image); if(Greenfoot.mousePressed(pionBlanc.class)==true){ setLocation(getX()+50, getY()+50); } } }