whenever i fail my game alot i get this error and i dont know what it is. i need help solving the problem.
this is the error code:
and here are the codes it is talking about
java.lang.OutOfMemoryError: Java heap space at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:75) at java.awt.image.Raster.createPackedRaster(Raster.java:467) at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032) at java.awt.GraphicsConfiguration.createCompatibleImage(GraphicsConfiguration.java:186) at greenfoot.util.GraphicsUtilities.createCompatibleTranslucentImage(GraphicsUtilities.java:186) at greenfoot.GreenfootImage.<init>(GreenfootImage.java:130) at Announcement.makeGameOver(Announcement.java:36) at Announcement.<init>(Announcement.java:24) at BaseClass.gameOver(BaseClass.java:129) at LittleRedCap.act(LittleRedCap.java:39) at greenfoot.core.Simulation.actActor(Simulation.java:567) at greenfoot.core.Simulation.runOneLoop(Simulation.java:530) at greenfoot.core.Simulation.runContent(Simulation.java:193) at greenfoot.core.Simulation.run(Simulation.java:183)
public void makeGameOver()
{
Color color = new Color (RED,GREEN,BLUE,TRANSPARENCY);
GreenfootImage image = new GreenfootImage(WIDTH, HEIGHT);
image.setColor(new Color(0,51,51,TRANSPARENCY+30));
image.fillRect(0, 0, WIDTH, HEIGHT);
setImage(image);
image.setColor(new Color(0,0,0,TRANSPARENCY+100));
Font font = image.getFont();
image.setFont(font);
image.setFont(image.getFont().deriveFont(20f));
font = font.deriveFont(FONTSIZE+1000);
image.drawString("You lose. Press space", 65 , 150);
image.setColor(new Color(0,153,76,TRANSPARENCY+30));
image.fillRect(15, 15, WIDTH-30, HEIGHT-30);
image.setColor(new Color(51,255,153,TRANSPARENCY-70));
image.fillRect(30, 30 ,WIDTH-60, HEIGHT-60);
} public Announcement()
{
makeGameOver();
} public void gameOver() {
World world = getWorld();
if(this.score<0)
{
removeObject (House.class);
world.removeObjects(world.getObjects(Flower.class));
world.addObject (new Announcement(), 300,300);
if(Greenfoot.isKeyDown("space"))
{
Greenfoot.setWorld(new Level1());
}
}
}public void act()
{
if(littleRedCapGray)
{
keys();
RemoveFlame();
}else {
keysArrows();
RemoveLava();
RemovePillar();
}
pickFlowers();
gameOver();
getEaten();
winner();
CoinGrab();
winportal1();
}
