mercredi 5 octobre 2016

Space Invaders game shows empty window after compilation and "Exception in thread" error in console

Vote count: -1

Trying to write Space Invaders game.

You can see my code for this app on GitHub.

I using this tutorial and complete first 14 lessons and all was OK, program compiled without errors and run correctly. But after video 15 program stop working correctly and shows following errors in console:

Exception in thread "Thread-3" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at spaceinvaders.sprite.SpriteAnimation.draw(SpriteAnimation.java:37)
at spaceinvaders.enemytypes.EnemyTypeBasic.draw(EnemyTypeBasic.java:43)
at spaceinvaders.levels.Level1.draw(Level1.java:33)
at spaceinvaders.gamescreen.GameScreen.draw(GameScreen.java:32)
at spaceinvaders.state.StateMachine.draw(StateMachine.java:23)
at spaceinvaders.display.Display.draw(Display.java:104)
at spaceinvaders.display.Display.run(Display.java:86)
at java.lang.Thread.run(Thread.java:745)

Please, help me find reason of this error and fix this.

This pic shows how game works before video 15 enter image description here

This pic shows how game works after video 15 enter image description here

asked 2 mins ago

Let's block ads! (Why?)



Space Invaders game shows empty window after compilation and "Exception in thread" error in console

Aucun commentaire:

Enregistrer un commentaire