Answer to Question #3076 in AJAX | JavaScript | HTML | PHP for David

Question #3076
Hey I'm just wondering when I run my program it shows theres something wrong with one of my method "turn":
Method:
public void turn()
{
Move move = ui.nextMove();
if (move == Move.LEFT || move == Move.RIGHT)
{
player.move(move.dx);
if (player.isAlive() && exit.found(player) && itemsCollected())
exit.take();
}
else if (move == Move.DOWN)
{
for (int i=0;i<items.length;i++)
player.pickup(items[i]);
}

for (int i=0;i<enemies.length;i++)
enemies[i].attack(player);

}

The results of the program comes out with:

Your move (l/r/p): l
>
> java.lang.NullPointerException
> at Game.turn(Game.java:123)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Metho
> at

PLEASE HELP ASAP =)
1
Expert's answer
2011-06-09T13:51:59-0400
We need the whole code to answer to your question. submit your assignment to our control panel and our experts will help you.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS