Hello! Sorry for the frequent help needed... I'm very new to greenfoot.
Is it possible to set another actors image from when a button actor is clicked?
Example:
If i click a button another actor's image will change from green to red and visa versa.


1 2 3 4 5 6 7 8 9 10 | // out of all methods private ButonActor button = new ButtonActor(); // in constructor addObject(button, x, y); // with other methods public ButtonActor getButton() { return button; } |
1 2 3 4 | public void act() { ButtonActor button = ((WorldName) getWorld()).getButton(); if (Greenfoot.mouseClicked(button)) setImage(... } |