I'm new to Greenfoot so I need a little help,I want to delete an actor through the world but I am unsure how, this is my code so far:
public class Comhoiriúnaigh extends World
{
/**
* Constructor for objects of class Comhoiriúnaigh.
*
*/
public Comhoiriúnaigh()
{
super(640, 480, 1);
Asal2 a1 = new Asal2();
addObject (a1, 81, 73);
AsalWord a2 = new AsalWord();
addObject (a2, 400, 73);
if (Greenfoot.mouseClicked(a1))
{
removeObject(a1);
removeObject(a2);
}
}
}