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

Comments for A flies life

Return to A flies life

SPowerSPower

2012/2/19

Great art! Are you going to add keyboard controls to it? That would be great.
Game/maniacGame/maniac

2012/2/19

what do you mean?
Game/maniacGame/maniac

2012/2/19

to the spider?
Game/maniacGame/maniac

2012/2/19

what should i do in my next scenario
danpostdanpost

2012/2/19

I have to keep clicking on the 'Run' button 'cause it keeps stopping.
Game/maniacGame/maniac

2012/2/19

yeah its a bug i need to find and fix
Game/maniacGame/maniac

2012/2/19

all i know is its part of the die method
danpostdanpost

2012/2/19

I'll download and take a look.
Game/maniacGame/maniac

2012/2/19

thx
Game/maniacGame/maniac

2012/2/19

the die code is located in Fly.class
danpostdanpost

2012/2/19

Reverse the last two lines of code in the Fly class (add the burger before removing fly).
A new version of this scenario was uploaded on Sun Feb 19 19:19:47 UTC 2012
Game/maniacGame/maniac

2012/2/19

it works thx
danpostdanpost

2012/2/19

The terminal window is there to assist you. You were getting a message that started with: Line 1: java.lang.NullPointerException Line 2: at Fly.die(Fly.java:135) Line 3: at Fly.act(Fly.java:32) Line 1 tells you why the scenario stopped (the error type) Line 2: tells you where in your code the error occurred (line 135 of the Fly class in the die() method) Line 3: may show where the method was called from (line 32 of the Fly class in the act() method) Lines 2 will not always be immediately after the error type, but will be somewhere in the message (it will be the first one that is recognizably in your scenario)
danpostdanpost

2012/2/19

The 'NullPointerException' is one of the most common run-time error messages. It is telling you that you are trying to do something to nothing as if it were something. That kind of sounds strange, I guess, but in your case, after the fly is removed, it no longer has a world; therefore 'getWorld()' in the next line becomes 'null'; hence, the 'NullPointerException'.
Game/maniacGame/maniac

2012/2/19

Thx for the advice
A new version of this scenario was uploaded on Sun Oct 07 16:55:13 UTC 2012 bug fix