Here's my code:
public void pointAtObject()
{
Actor h = getOneObjectAtOffset(0,0,House.class);
setRotation((int)(Math.atan2(h.getY()-getY(),h.getX()-getX())/Math.PI);
}
Here's the output:
java.lang.NullPointerException
at Player.pointAtObject(Player.java:36)
at Player.checkKeys(Player.java:30)
at Player.act(Player.java:7)
at greenfoot.core.Simulation.actActor(Simulation.java:498)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:461)
at greenfoot.core.Simulation.runContent(Simulation.java:197)
at greenfoot.core.Simulation.run(Simulation.java:187)
The pointAtObject() method is inside the actor that will be pointing, and it is supposed to point to an actor named "House."


