for example
i taked from one of my actor
here the code
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Mat2 here. * * @author (your name) * @version (a version number or a date) */ public class Mat2 extends Mats { /** * Act - do whatever the Mat2 wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { Touching(); } public void Touching() {if (isTouching(Blizzard.class)) { if (getWorld() instanceof ParentsHome) { World pgh = new PlaygameHome(); pgh.removeObjects(pgh.getObjects(Dialogue.class)); ((ParentsHome)getWorld()).Back.stop(); Greenfoot.setWorld(pgh); } } } public void location() {((Blizzard)Greenfoot.()).setLocation(778, 107);} }