Hi i want an image to change every time it moves 1 Y down (or 5 or 10 Y) so it is some kind of GIF without being a actual GIF image
here is the code
what i want is that the name of the image stays the same and every time the number is +1 so
imagename
imagename
etc.
when at imagename
it has to go back to imagename
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Booster here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Booster extends Objects
{
/**
* Act - do whatever the Booster wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
dropSpeedBooster();
//spinningImage();
}
public static int YB;
public int getYPosition(){
YB = getY();
return YB;
}
public void spinningImage()
{
if (getWorld() != null) {
//int y1 = getY();
//int a1=0;
//int a2=Y-a1;
int a2 = getYPosition();
if (a2>=21)
{
getWorld().addObject( new Booster(), ran+130, 0);
}
}
}
}


