This is used when I touch the ice and the speed will decrease by 3, after 100 counts it will set to orinigal 43 again, but when I run the program it never set back to 43 after I touch the ice.
public class ice extends Actor
{
public int timer=0;
public boolean freeze=false;
/**
* Act - do whatever the ice wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
timer=0;
if(isTouching(pacman.class)){
timer++;
freeze=true;
getWorld().removeObject(this);
Greenfoot.setSpeed(40);
}
if(freeze=false){
Greenfoot.setSpeed(43);
}
if(timer>=100){
Greenfoot.setSpeed(43);
freeze=false;
timer=0;
}
// Add your action code here.
}
