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
Access a variable to another class
By Ramin, with 3 replies.
Last reply by danpost, almost 11 years ago:
fejfo wrote...
in class a put : <Code Omitted><image> should be a GreenfootImage where you store the varible
Two problems with this: (1) you cannot set a method call to a value; 'getWorld().getObjects(ClassB.class).isEmpty() = false' does not make any sense. To compare the returned 'isEmpty' value with false, you need to use the conditional equality operator which consists of 2 equal signs ( '==' ). To check for a 'false' value, you could just negate
gravity help
By davemib123, with 16 replies.
Last reply by davemib123, almost 11 years ago:
wicked that works wonderfully :)
ScoreBoard class
By LegendMan55, with 1 reply.
Replied to by danpost, almost 11 years ago:
LegendMan55 wrote...
What is the code for create ScoreBoard best score are in top
There is a ScoreBoard class that is importable. With the menubar, select "Edit>Import class..." to access it and add it into your project. Then you can look at its code to see what it is. If you were wanting to know how to create a ScoreBoard object: <Code Omitted>Follow it with adding it into the middle
GameOver screen after 3 humans died
By Ramin, with 5 replies.
Last reply by danpost, almost 11 years ago:
Ramin wrote...
the game won't stop because the variable doesn't work.
It might be where you are coding it from. If you do not yet have an 'act' method in your subclass of World, move the 'act' method to it. Instead of 'peopleDied', use 'HUMAN.peopleDied' to access the variable. Also, change 'protected' to 'public' on the variable declaration line.
move in the other direction atWorldEdge without turn()
By Ramin, with 3 replies.
Last reply by danpost, almost 11 years ago:
An easy way for 8-way movement is to add an instance int field to track the current direction. Let its value be from zero to seven depending on the current direction (times 45 degrees) that is should travel. Then you would have: <Code Omitted>
Selection of objects
By Newbie, with 3 replies.
Last reply by danpost, almost 11 years ago:
Newbie wrote...
Thank you for your help, but for some reason your suggestion didn't work
I did not work because, although I did specify a class field, I forgot to include the "static" modifier to the field declaration line.
Newbie wrote...
I added the static variable selectionCounter to the code of Profile.class. 1 is added to it when an image of one of the objects changes to the one with the cross (when it's been clicked at), and 1 gets subtracted when an object changes its image the other way round. This works better for me, but thanks anyway!
Okay -- the way you ended up with
Problem with Moving object forward direction it's facing
By RendraDT, with 1 reply.
Replied to by danpost, almost 11 years ago:
I believe your issue deals with the layout of pixel. Imagine a checkerboard, where each square represents a pixel -- an absolute position any actor can be located at. When you move two spots away (I use '2' because that is how fast a bullet is moving in your scenario) from any square, there are only 8 possible new locations that can be arrived at. Basically, if the actor is not moving at one of these 8 angles exactly, there is a loss in precision in the angle being moved (there is a loss in precision in the distance moved when not moving at one of the 4 ordinal directions). Knowing this sh
Score won't increase
By RobotDJS, with 5 replies.
Last reply by RobotDJS, almost 11 years ago:
Thanks. It worked.
Exercise 6.9 Greenfoot Textbook
By JaneSmith, with 1 reply.
Replied to by davmac, almost 11 years ago:
You should read that as "which of the methods ... can you call interactively, that is, through the object's menu?". Calling a method interactively is what you are doing when you click on a method in the menu. (In distinction, calling a method
programmatically
is when you write code to call the method).
Greenfoot on Vista
By Jasic, with 2 replies.
Last reply by Jasic, almost 11 years ago:
davmac - Thanks for your suggestion. It didn't work so I uninstalled jdk, etc. and Greenfoot 2.4.2. I installed Greenfoot 3.0.2 on its own (having learned that jdk is bundled with it) but it didn't work. BUT when i fired up my laptop today, the Greenfoot IDE worked!!! I surmise that somewhere in the Vista operating system something somewhere was set that had not been set when I downloaded the IDE and used it right away. I'm bothering to post this item because there may be other old codgers who want to help their grandchildren with Greenfoot but who don't want to upgrade their operating sys
prevent constructor from resetting values
By davemib123, with 2 replies.
Last reply by davemib123, almost 11 years ago:
thanks danpost that works :)
Greenfoot class documentation can't display
By Kang_Akmal, with 2 replies.
Last reply by davmac, almost 11 years ago:
Kang_Akmal: I think that Greenfoot 3.0.2 (just released) might resolve this issue.
what is wrong with this
By divinity, with 11 replies.
Last reply by danpost, almost 11 years ago:
divinity wrote...
it is also controlling the level. I am not all that versed in arrays, i know it would help the game since arrays is not my strong point it is difficult for me to understand how to place the data in arrays.
Maybe looking over
this page
of the java tutorials might help.
Windows 10 installation help
By keizerbob, with 2 replies.
Last reply by keizerbob, almost 11 years ago:
kenvandine wrote...
I'm experiencing the same thing on both Windows 10 and Ubuntu 15.04 with 3.01. If I right click on the world class I see it needs compiling, but the canvas says there's an error in the scenario. This happens whenever I try to create a new Stride scenario.
kenvandine: I also sent a description of this problem to the support email address and got this reply:
Greenfoot should pop up a dialog when you load those scenarios and prompt you to save the project somewhere else. But unfortunately, it turns out this check was broken on Windows 10. I've just fixed t
time countdown affected by speed of game/computer speed/framerate
By rsvohra, with 4 replies.
Last reply by danpost, almost 11 years ago:
I believe it is actually called the SimpleTimer class. You can import it into your scenario using the menubar -- "Edit>Import class...".
512
513
514
515
516
517
518
X