Sorry for not explaining it properly but It doesn't actually display at all. As in it doesn't do anything.. at all
if ("v".equals(Greenfoot.getKey()))// instance field
private boolean shotKeyDown;
// in act method or a method it calls
if (shotKeyDown != Greenfoot.isKeyDown(shotkey)) // shotkey = "v" for player one
{
shotKeyDown = !shotKeyDown; // save changed state
if (shotKeyDown) // changing to down state?
{
// shoot code here
}
} public void respawn()
{
if (getObjects(VirusWASD.class).size() == 0)
{
addObject(new VirusWASD(),173 ,429);
}
} private void infect()
{
if (Greenfoot.mouseClicked(twoPlayer_Button)) // countdown starting
{
countdown = 16; //2276
}
if (countdown == 0) return; // countdown already completed
countdown--;
if (countdown == 0) // countdown just completed
{
setPaintOrder(InfectionHasStarted.class, GameTimerGif.class, TimerBackground.class);
addObject(new InfectionHasStarted(), 695, 393);
addObject(new TimerBackground(), 691, 47);
addObject(new GameTimerGif(), 687, 48);
Actor[] viruses = new Actor[] { new VirusWASD(), new VirusARROW() }; // must be same order as 'survivors'
int chosen = Greenfoot.getRandomNumber(2);
addObject(viruses[chosen], survivors[chosen].getX(), survivors[chosen].getY());
removeObject(survivors[chosen]);
respawn();
//removeObject(twoPlayer_Button); // optional
}// for example
int[][] locs = { { 173, 429 }, { 252, 357 }, { 211, 499 } };
// a random location choice would be
int rand = Greenfoot.getRandomNumber(locs.length);
int x = locs[rand][0];
int y = locs[rand][1];
addObject(new VirusWASD(), x, y);if (getObjects(SurvivorWASD.class).isEmpty()) // or if (!getObjects(VirusWASD.class).isEmpty())