This site requires JavaScript, please enable it in your browser!
Greenfoot back
syahwa_anugrah_ainu
syahwa_anugrah_ainu wrote ...

2022/3/10

Please help,,is there a way to make this program work?

import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class evil here. * * @author (your name) * @version (a version number or a date) */ public class evil extends Actor { /** * Act - do whatever the evil wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { setLocation(getX()+10,getY()); if(getX()==1119) { getWorld().removeObject(this); } Actor k = getOneIntersectingObject(ld.class); if(k !=null){ getWorld().removeObject(this); } } }
Super_Hippo Super_Hippo

2022/3/10

#
You could add a “return;” after the first “getWorld().removeObject(this);”.
thanks for the information bro
You need to login to post a reply.