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); } } }
![Twitter](/assets/twitter-4e19209ef84344ee0c433f4c7bad8d49.png)
![Twitter.hover](/assets/twitter.hover-1fb19a5bafc50deace8f88eaec867845.png)