Hi so I wanted to create 2 shields in my Space Invaders class that you can hit with a missile or bomb, but when I created them both, only one you are able to shoot at... here are my segments of code...
Type: Posts; User: kendraheartt
Hi so I wanted to create 2 shields in my Space Invaders class that you can hit with a missile or bomb, but when I created them both, only one you are able to shoot at... here are my segments of code...
Null Pointer Exception fixed.
Null Pointer Exception fixed.
Row: 1, 2, 3... 25
Col: 1, 2, 3.... 25
shield[row][col] didn't show up when i put in the println statements and
added what you told me to print i got an error saying the Variable Arrays could not...
if ((!shield[row][col].isHidden () && (shield[row][col].overlaps (missile)) || shield[row][col].overlaps (bomb))) is the line where i keep getting the NPE... Sorry but I don't quite understand what...
when I include both it comes back as both of them as null if i include both of them in the if statement (both the missile and the bomb), but if i only include one in the if statement it doesn't give...
It works only if I isolate each variable (the bomb works if I don't include the || (!shield[row][col].isHidden () && shield[row][col].overlaps (missile)) portion and vice versa for the missile... is...
It says Exception in thread "Thread-37" java.lang.NullPointerException
at objectdraw.Drawbale2D.overlaps (Drawable2D.java:123)
at Shield.isHit(Shield.java:103)
at Bomb.run(Bomb.java:87)
whenever...
Okay, so I just did the same thing for the missile as I did the bomb, and I'm still getting the null pointer exception. Im pretty sure theres an error with theShield variable, but I cant seem to...
Null Pointer Exception fixed.
Oh okay thats what I did wrong :) I assigned it and it works now thank you so much :)
theShield is in the instance fields
I got this message when I ran the applet:
Exception in thread "Thread-36" java.lang.NullPointerException at Missile.run(Missile.java: 108)
this only happened when I shot the missile, but it the...
Okay so I am writing a program for a space invaders game, and i keep getting a null pointer exception when in my missile class. I can't seem to figure out what went wrong... If anyone could help me...