For an assignment I have one of the requirements it stated by pressing c the ship should be able to cloak itself and to avoid collision with an asteroid the cloak should last 50 moves. Not sure how to write a code to do these actions.
Well I know how to set it up where when you press the letter c the action take place using the checkKeys method:
/**
* Check whether there are any key pressed and react to them.
*/
private void checkKeys()
{
ignite(Greenfoot.isKeyDown("up"));
if (Greenfoot.isKeyDown("left"))
{
setRotation(getRotation() - 7);
}
if (Greenfoot.isKeyDown("right"))
{
setRotation(getRotation() + 7);
}
if (Greenfoot.isKeyDown("z"))
{
fire();
}
if (Greenfoot.isKeyDown("u"))//
{
startProtonWave();
}
What do you need to do to make the ship invisible without removing the ship from the world? (Hint: what object does it involve and what do we need to do with it?)
That does not answer my question. I was asking about how to go about making the ship invisible. What can you do to make the ship not visible yet still be in the world?