So i am trying to use a GIF in my project and keep gett a error
java.lang.OutOfMemoryError: Java heap space
at GifImage.loadImages(GifImage.java:127)
at GifImage.<init>(GifImage.java:48)
at GameOv.<init>(GameOv.java:11)
at Birdy.signGameOv(Birdy.java:116)
at Birdy.birdDead(Birdy.java:125)
at Birdy.act(Birdy.java:152)
I have imported the GifImage Class & made an actor class with the gif image set to it and this being my code in it
and I am trying to use it in another class as a method that i can call upon when needed, in this way:
1 2 3 4 5 6 7 8 9 10 11 12 | public class GameOv extends Actor { GifImage myGif = new GifImage( "GameOver.gif" ); /** * Act - do whatever the GameO wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void GameOv() { setImage(myGif.getCurrentImage()); } } |
1 2 3 4 5 6 7 8 9 10 | /** any suggestions on what im doing wrong? *inserts gif that signals losing. */ private void signGameOv() { GameOv gameOver = new GameOv(); getWorld().addObject(gameOver, getWorld().getWidth()/ 2 ,getWorld().getHeight()/ 2 ); } |