Hello,
Why does a click on the transparent part of the image count as a click on the image and how can I change this?
I have already seen a similar question at https://www.greenfoot.org/topics/62839/0, but it does not answer my question exactly.
I once tried to write a code where the colors of the clicked image are recognized at the location of the mouse pointer. Unfortunately the code does not work.
Are there other approaches? How do I get it that a click on the transparent part of the image is no longer counted as a click on the image?
MouseInfo info = Greenfoot.getMouseInfo(); GreenfootImage img = getImage(); Color color = new Color(0,0,0,0); if(Greenfoot.mouseClicked(this)){ if (img.getColorAt(info.getX(),info.getY()).equals(color)) { } else { setLocation(getX()-70, getY()); setImage("/Users/mc1/Desktop/Picture1.png"); } }