This is what I have but it doesnt really work because all of the movements are really fast I want the actor to make random movements across a 400 pixel wide Y axis without changing the X axis variable, is this possible?
private GreenfootImage Change = new GreenfootImage("Transparent Jordan mouth opened.png");
/**
* Act - do whatever the Jordan wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public boolean firing2 = MyWorld.firing;
public int ranTurn = 0;
public String[] pM = {"+","-"};
public void act()
{
if(JumpPortal.level2)
{
getWorld().addObject(this, 200, 575);
ranTurn++;
if(ranTurn <= Greenfoot.getRandomNumber(80))
{
setLocation(getX(), getY() - 3);
}
if(ranTurn > Greenfoot.getRandomNumber(80) + 80)
{
setLocation(getX(), getY() + 3);
}
else if( ranTurn > 50)
{
ranTurn = 0;
}
else if(getY() == 1)
{
setLocation(getX(), getY() + 3);
}
else if(getY() == 399)
{
setLocation(getX(), getY() - 3);
}
}
}
}
