In mine, remove the first 'setColor' and 'fill' lines.
In yours, as far as I can tell, there is no back color.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.awt.Color; /** * Write a description of class Coming here. * * @author (your name) * @version (a version number or a date) */ public class Coming extends Actor { private int width; private int height; private boolean turning; GreenfootImage baseImage; // the base image that gets scaled int percentage = 10; // percentage amount to scale base image by boolean xRegistered = false; double exactX; int amount; public Coming() { baseImage = getImage(); updateImage(); // initializing image of actor } /** * Act - do whatever the Coming wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { if(!xRegistered){ exactX=getX(); xRegistered=true; amount = (int)exactX-250; }else{ updateImage(); } exactX+=amount/7; setLocation((int)exactX, getY() + 7); percentage = (int)((double)percentage + 10); if(getY() > 180) getWorld().removeObject(this); } private void updateImage() { GreenfootImage image = new GreenfootImage(baseImage); image.scale(image.getWidth()*percentage/100, image.getHeight()*percentage/100); setImage(image); } }
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Link here. * * @author (your name) * @version (a version number or a date) */ public class Link extends Actor { /** * Act - do whatever the Link wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { if(Greenfoot.isKeyDown("left")) { setImage("LinkKartLeft.png"); setLocation(getX()-8, getY()); } else if(Greenfoot.isKeyDown("right")) { setImage("LinkKartRight.png"); setLocation(getX()+8, getY()); } else setImage("LinkKartBack.png"); Coming coming = (Coming)getOneIntersectingObject(Coming.class); if(coming != null && coming.getY()>getY()-5) getWorld().removeObject(this); } }
public void comings() { Coming coming = new Coming(); addObject(coming, Greenfoot.getRandomNumber(90) + 205, 2); }
public void comings() { Coming coming = new Coming(); addObject(coming, Greenfoot.getRandomNumber(51) + 220, 2); }