This site requires JavaScript, please enable it in your browser!
Greenfoot back

What is happening right now?

davmac

reply to NullPointerException

By davmac - about 3 hours ago
You haven't posted all the class code, so I can't see which line is line 27 (the line the exception happens on). That makes it harder to help you. However I can see some problems with your code:
  • You call 'getWorld()' after removing 'this' from the world in several places. Once 'this' has been removed from the world, getWorld() will return null. You can fix it by checking that getWorld() is not null before you try to use it - if (getWorld() != null) ...
  • On line 19 you cast the world to a 'Contador' and then try to get objects inside it which are of class 'Contador'. That doesn't make sense. If Contador is a world class, then the world cannot contain Contador objects.
spider65

reply to How do you make a health bar?

By spider65 - about 10 hours ago
Thanks. But when I do it, it shows that it cannot find symbol - variable Style.
Gamercheez

reply to Clicking Problems

By Gamercheez - about 17 hours ago
OK, thanks. I'll try that.
Super_Hippo

reply to How do I rename a world I already created?

By Super_Hippo - 1 day ago
If you open the class code, you will find a line like 'public class World extends World'. Rename the first World to the new name. The constructor (→all constructors) needs to have the same name, so change the World in 'public World()' to the new name as well.