import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Stone here. * * @author (your name) * @version (a version number or a date) */ public class Stone extends Enemy { private int relocation; public Stone() { turn(90); } public void act() { move(3); removing(); colision(); } public void colision() { if(isTouching(Blast.class)) { removeTouching(Blast.class); getWorld().removeObject(this); } } public void removing() { if (isAtEdge() & relocation <= 1) { setLocation(50 + Greenfoot.getRandomNumber(550), 1); relocation ++; } if(relocation == 3) { getWorld().removeObject(this); } } }

