Sup,
I am studying for an informatics exam I have coming up and I am coding all of our scenarios again.
I stumbled upon this task: "let the starting location be random - this is done by the method setLocation(int);
Here is my code, but: If I put it into the method that constructs it, I cant call it, and if I put into the Redcell class into act(); , they spin like maniacs. I just need to set the start rotation once!
Pls help :) I know this is probably easy to solve but I am mentally challenged, kappa
In Redcell:
In World:
private int speed = Greenfoot.getRandomNumber(1)+1;
/**
* Act - do whatever the Redcell wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
setLocation(getX()-speed, getY());
//setRotation(Greenfoot.getRandomNumber(360));
turn(1);
if (getX() == 0)
{
getWorld().removeObject(this);
}
} if (Greenfoot.getRandomNumber(100) < 6)
{
addObject (new Redcell(), 779, Greenfoot.getRandomNumber(359));
//setRotation(Greenfoot.getRandomNumber(360));
}

