i need some help making a button click. I know it is very simple to make a button in any game, but i don't know why it is so complicated because i can't get my button to click properly. Some sources say that my buttons transparent background is messing with the clicking, but im not sure. In the code i provided i made it so when the button is clicked it will do move(4); just so i can check whether my button is clicking or not. it kind of works but it doesn't allow me to click on the image it self and it only lets me click outside of the buttons image where the transparent background is. here is my code:
import greenfoot.*; public class Play_button extends Actor { public Play_button() { GreenfootImage pB = new GreenfootImage("play_button.png"); pB.scale(pB.getWidth()/3, pB.getHeight()/3); setImage(pB); } public void act() { if (Greenfoot.mouseClicked(this)) { move(4); } } }