So i switched the for loops arround and that was it and now it works.
Here is the code if anyone wants it.
private void colision() {
if (aliens.size() >= 1 && bullets.size() >= 1) {...
Type: Posts; User: The_pizzaguy
So i switched the for loops arround and that was it and now it works.
Here is the code if anyone wants it.
private void colision() {
if (aliens.size() >= 1 && bullets.size() >= 1) {...
i havent tried that yet but i dont think it will make a diffrence
but ill do that now
--- Update ---
well i initilasid the bullits earlier but what happens is that the were shot and afther...
as said in the top its
at com.spaceinvader.Main.colision(Main.java:172)
line 172 thus
if (bullets.get(i).getBounds().intersects(aliens.get(i2).getBounds())) {
in the colision methode
it...
So i am recreating space invaders to teach myself some game programming.
For the first time i have started to use ArrayLists.
But every time i run it i get an java.lang.IndexOutOfBoundsException...