This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
Discussions
You need to login to take part
Current Discussions
How to Get Integers to Persist Through Worlds
By Matt_Baker11, with 2 replies.
Last reply by SPower, over 9 years ago:
You could also create a separate class (one that isn't a subclass of Actor or World), and store the numbers there. This class could, for example, be called PlayerData, and each time a new world is created, it asks that class for numbers you want to pass through.
how can I add new actors below existing actors?
By Griffon, with 4 replies.
Last reply by danpost, over 9 years ago:
Ryan.stephens31 wrote...
Morran wrote...
Inside of your world class, you can add a method "setPaintOrder(
firstClass.class
,
secondClass.class
,
thirdClass.class
, ...
lastClass.class
);"
I'm trying to do this above and am receiving java.lang.NullPointerExeception. Any Ideas what is going on?
You should refrain from reviving old discussion thread and create a new one for your issue. Include the code around which the error occurred and copy/paste the complete error message to allow us to determine where the problem resides.
Add new asteroids when all have been cleared
By sophiasturges, with 18 replies.
Last reply by danpost, over 9 years ago:
Jonade21 wrote...
hello. can someone please help me as when I try to say Space space = (Space) getWorld(); it says that getWorld could not be found. btw this is in my space class. should it be somewhere else?
The World class API does not contain a 'getWorld' method as does the Actor class API. However, if you are trying to code this in the Space class, you only need to use the 'this' keyword. That is: <Code Omitted>The thing about it is that you do not need this line at all in this class:
Sequence Statement Error
By Gaddiel, with 18 replies.
Last reply by Super_Hippo, over 9 years ago:
Sure: <Code Omitted>
Objects dn't spawn in a scrolling world
By TheBigBossJoshi, with 10 replies.
Last reply by TheBigBossJoshi, over 9 years ago:
Hello, unfortunately, my scenario is too large to upload. Can I email you a project file?
help?
By MLP, with no replies.
this is my code for cakes for age. it works for odd number but when it comes to even number is doesn't work. for (eg) if i put in 77 for the age there is no problem it unless if i key in 24 it doesn't work. please help? class MyClara extends Clara { /** * In the 'run()' function you can write your program for Clara */ void run() { int height; height = readInt ("How old is your grandmother?"); while (height > 77) height = readInt ("Enter a number Less than or = 77"); for (int width = 0; width < 21; width ++) { forward(); } turnLeft(); for (int hw = 0; hw < (height-height % 10) / 10 + 3; hw ++) { forward(); } turnLeft(); for (int width = 0; width < 21; width ++) { move(); } turnLeft(); for (int hw = 0; hw < (height - height % 10) /10 +2; hw ++) { backward(); } turnLeft(); move(); int h = 0; for (int hw = 0; hw < ((height -(height % 10)) / 10); hw ++) { for (int l = 0; l < 10; l++) { putLeaf(); move(); move(); } if (h == 0) { running(); h = 1; } else { walking(); h = 0; } } for (int i = 0; i < (11 - height % 10); i ++) { move(); } for ( int i = 0; i < height % 10; i ++) { putLeaf(); move(); move(); } } void forward() { putLeaf(); move(); } void backward() { move(); putLeaf(); } void running() { turnLeft(); move(); turnLeft(); move(); } void walking() { turnRight(); move(); turnRight(); move(); } }
Greenfoot not compiling
By Pink_Piranha, with 9 replies.
Last reply by davmac, over 9 years ago:
Camyh15, this discussion is literally 5 years old. Please don't re-open ancient discussions; start a new one if necessary.
play and stop buttons for jukebox project
By Alucard, with 2 replies.
Last reply by danpost, over 9 years ago:
Maybe you should have a 'public static Button playButton;' field and when the appropriate value (-1) is passed to the constructor, have the field set to 'this' object being created. Also, a 'public static' array of the "play" and "pause" images might help for later comparisons so the individual song buttons can do what needs to be done with it at the appropriate times (to check which image the playButton is currently showing and act accordingly).
Making a Memory Game
By carter, with 46 replies.
Last reply by carter, over 9 years ago:
danpost, thank you so much for all your help. I wouldn't even be close to being done if it wasn't for your help. I turned the project in and will keep you posted about the grade I get (if you would like). :)
bad operand types for binary operator
By divinity, with 3 replies.
Last reply by danpost, over 9 years ago:
The gross_salary field used on line 40 is never assigned any value. The overtime variable is not used after assigned a value at line 36. The hrs field is only assign a new value (default is zero) if the hours worked was exactly 40. A consequence of this might show some other issues. Let us say that the first employee worked exactly 40 hours and the hrs field is assigned its proper value. Then the next employee, who did not work 40 hours, will not re-assign a new value to the field. The value will remain what it was for the first employee. Certainly, this cannot be what you would want.
Balloon-Popping Game
By IronRod, with 40 replies.
Last reply by IronRod, over 9 years ago:
Thank you so much @danpost, I really do appreciate all the advice you have given. My game works fine now. ;)
Out Of Memory error on compile
By trimil, with 5 replies.
Last reply by trimil, over 9 years ago:
Nah, I like using the reflect classes.
moving actor one given location and go to another
By NIRO17, with 21 replies.
Last reply by danpost, over 9 years ago:
NIRO17 wrote...
danpost, have you heard about multi agent technoly in Ai? can we use greenfoot gaming platform to develop a multi agent simiulator? can we apply JADE or MadKit like libaries to work with greenfoot?
You can use greenfoot to do pretty much anything you can do outside of greenfoot. The documentation for native libraries is
here.
Scrolling world
By GB309, with 50 replies.
Last reply by danpost, over 9 years ago:
GB309 wrote...
THANKS
danpost wrote...
... (code acquiring x-coordinate value shown here). < Code Omitted >
Wow -- did I do that??? More simply coded would be this for the third line: <Code Omitted>
multi agent with greenfoot
By NIRO17, with no replies.
have you heard about multi agent technoly in Ai? can we use greenfoot gaming platform to develop a multi agent simiulator? can we apply JADE or MadKit like libaries to work with greenfoot?
468
469
470
471
472
473
474
X