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

What is happening right now?

NIRO17

reply to moving actor one given location and go to another

By NIRO17 - 40 minutes ago
and this is my zombie class... i am confusing with how to chage this code according to my senario.. this zombie only find the parent in the world and eat and stuck in the final parent location.but i want to after finishing eat the parent, immidiatly go to the child locations and eat child and stop like parent. <Code Omitted>
danpost

reply to Illegal State Exception error help

By danpost - about 3 hours ago
Your 'hitDetection' method calls the 'isTouching' method. If the actor is not in a world, it would be impossible for this to even be checked on (the actor will not even know what world to look for collision in -- because there is no world to do it in). Your 'act' method removes the actor when it reaches near the top of the world; then it calls the 'hitDetection' method which requires the actor be in the world before calling the 'isTouching' method, throwing the error. By ensuring that the actor is in a world (the 'getWorld' method returns which world, if any, the object is in), the error can be avoided. If it is not in a world the value returned is 'null', meaning that no world currently has the actor in it. If the value returned is not 'null', then a World object is returned and we can then proceed to call any of the collision checking, location getting and movement methods.
CuddlySpartan

reply to Moving an Object When Touching Another

By CuddlySpartan - about 8 hours ago
Awesome thanks a ton! Its working perfectly :D