Can you help my why this code isn't work when I click the button ??
I don't know why this code is can't work when I clicked the button :(
public class Button1 extends Button { /** * Act - do whatever the Button1 wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { // Add your action code here. if(Greenfoot.mouseClicked(this)){ Counter counter = ((BeliHewan)getWorld()).getCounter(); if (counter.getValue() > 100) { Greenfoot.playSound("ChaChing.mp3"); counter.walkCount(counter.getValue()-100); } } } }