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

2012/4/3

Greenfoot bug

Michionlion Michionlion

2012/4/3

#
My project http://www.greenfoot.org/scenarios/4721 has a bug in it that does not through an error, there are no syntax errors, no logic errors (that i can find). It just stops after a bit (about 1-2 seconds) and you can't restart. This happens in greenfoot, in applet mode, and in jar mode.
mik mik

2012/4/3

#
There are probably two errors here: One is yours (a logical error) and probably one in Greenfoot. Your main error is in the Circle class, in the checkPickUps() method. You write while (getOneIntersectingObject(PickUp.class) != null) { That 'while' is the problem. When the intersecting object is not null (that is: the first time you touch something) you will go around this loop forever. You never get out, so the system seems to freeze. That's because the object only gets removed for the next frame (next act round), and the check will always check whether you were touching something in this act round. Use an 'if' instead. However, the fact that Greenfoot does not recover from this (with Reset or Compile) is probably a Greenfoot bug.
Michionlion Michionlion

2012/4/4

#
while, i did have a problem with that loop before. thanks for the info! i'm going to see if it exists in greenfoot 2.2.0 beta.
danpost danpost

2012/4/4

#
You should be able to open 'Controls' on the menu bar and select 'Show Debugger', then click 'Terminate'.
Michionlion Michionlion

2012/4/5

#
danpost - that does work, although sometimes its just easier to close and reopen.
You need to login to post a reply.