Is there an easy way to have an object move across the screen gradually getting bigger?
public void ifInIntro() { World world; world = getWorld(); if (world instanceof Intro) { GreenfootImage image = getImage(); image.scale(5, 5); } }
public void ifInIntro() { World world; world = getWorld(); if (world instanceof Intro) { GreenfootImage image = getImage(); int percentage = (getX()*100 /world.getWidth) ; int scale =5*percentage; image.scale(scale, scale); } }
double factor = (double)getX()/(double)getWorld().getWidth(); int size = minSize + (int)(factor*(maxSize-minSize)); GreenfootImage image = new GreenfootImage(baseImage); image.scale(size, size); setImage(image);