67 011
Assignments Done
99,4%
Successfully Done
In November 2018

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 =)
Expert's answer
We need the whole code to answer to your question. <a href="/assignments/index.php">Submit your assignment</a> 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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions