Okay, I don't really understand what you mean by that, but I managed to create a totally new bar and a new game over screen. There are still some errors though.
Here is my background:
It says
"illegal art of expression" and highlights "private void showGameOverCharWins()"
What should I do to fix this?
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
* Write a description of class bg1 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class bg1 extends World
{
/**
* Constructor for objects of class bg1.
*
*/
public Bar bar = new Bar("Pikachu", "Health Points", 100,100);
public Bar2 bar2 = new Bar2("Charmander", "Health Points", 100, 100);
public bg1()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
addObject(bar, 250,40);
addObject(bar, 400, 40);
prepare();
}
/**
* Prepare the world for the start of the program. That is: create the initial
* objects and add them to the world.
*/
private void prepare()
{
Ground ground = new Ground();
addObject(ground, 293, 393);
Platform platform = new Platform();
addObject(platform, 291, 193);
Platform platform2 = new Platform();
addObject(platform2, 107, 290);
Platform platform3 = new Platform();
addObject(platform3, 495, 283);
Pikachu pikachu = new Pikachu();
addObject(pikachu, 303, 105);
Pikachu pikachu2 = new Pikachu();
addObject(pikachu2, 295, 123);
pikachu2.setLocation(179, 143);
removeObject(pikachu2);
pikachu.setLocation(88, 210);
Charmander charmander = new Charmander();
addObject(charmander, 517, 198);
}
GreenfootSound music = new GreenfootSound("19 Hyrule Field Main Theme.mp3");
public void started()
{
music.playLoop();
}
public void act()
{
if (bar.getValue() == 0)
{
showGameOverCharWins();
Greenfoot.stop();
return;
}
if (bar.getValue() == 0)
{
showGameoverPikaWins();
Greenfoot.stop();
return;
}
private void showGameOverCharWins()
{
addObject(new GameOverCharWins(), getWidth() / 2, getHeight() / 2);
}
private void showGameOverPikaWins()
{
addObject(new GameOverPikaWins(), getWidth() / 2, getHeight () / 2);
}
public void stopped()
{
music.stop();
}
}
}
