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

What is happening right now?

Arakniode

reply to "Illegal character: '\u0000'" error at the end of file

By Arakniode - about 4 hours ago
Problem fixed! As I thought, the problem was with working on distant sessions at school. We tried other ways, and it appears that the problem is fixed by working on a local session, or even on an USB key. Thanks for your answer!
TheShyGuy

reply to How do I make 2 Actors, not run into each other, horizontaly and verticaly?

By TheShyGuy - about 15 hours ago
danpost wrote...
In line 14, 'i' needs to be less than 'size' (not greater than).
XD Thank you^^, i didn't see that.
matthijs124 wrote...
You can set up some kind of boolean like "isOccupied" and only move to the certain tile if the tile is NOT isOccupied --> but then you have to determine this BEFORE you move.
Thank you too^^, that gave me a good idea on something :3
danpost

reply to How do I get my scoreboard to function?

By danpost - about 8 hours ago
The ScoreBoard class is for when the game has ended and the Bullet class only shows that 'hit' is called on a hit asteroid. Nowhere is a running score shown or changed. What code do you have in the Asteroid class and World subclass (called MyWorld, possibly)?
danpost

reply to How to store a lot of information elsewhere

By danpost - about 15 hours ago
matthijs124 wrote...
In the MyWorld class, I have multiple (enormous) twodimensional arrays. In fact, they are getting in the way... Can I store these arrays in another class? I sometimes see in other scenarios some classes which are placed in the "Other Classes" category. Does that have something to do with it?
You can put them anywhere as long as they are accessible to wherever they are needed. It is always best to show what code you are talking about. Someone may find better alternatives other than what you think is possible.
danpost

reply to variable won`t get transfered to other class

By danpost - about 16 hours ago
BananaJoe wrote...
Iwhat do you mean with:
danpost wrote...
use of fields where variables are sufficient
what fields?
In the originally given codes of the Bin and Cannon classes, your fields (in both) were located on lines 4 through 9. When I had first gave a revision of the Cannon class, it had only one field on line 5. When re-worked, it was made a class field instead of an instance field. All the other that you originally had were either removed entirely or changed to local variables within one of the methods. There was no need to retain their values across act steps. Looking back, I see only the 'mx' and 'my' variables on lines 34 and 35. Once you check the position of the mouse, those coordinate values that were checked beome obsolete. They are not needed on any future act step; so they are fine as local variables.