Is there an easy way to have an object move across the screen gradually getting bigger?


1 2 3 4 5 6 7 8 9 10 | public void ifInIntro() { World world; world = getWorld(); if (world instanceof Intro) { GreenfootImage image = getImage(); image.scale( 5 , 5 ); } } |
1 2 3 4 5 6 7 8 9 10 11 12 | 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); } } |
1 2 3 4 5 | 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); |