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
Actor Spawning
By EmilinaZombie, with 2 replies.
Last reply by EmilinaZombie, almost 9 years ago:
Thank you! I'll check it out!
How do you put a single actor at the top of the world's paintOrder?
By CubeGamer6, with 1 reply.
Replied to by danpost, almost 9 years ago:
CubeGamer6 wrote...
I was thinking that there was some method like<Code Omitted>but i couldn't find anything. what i want is like with Windows where you have a multiple windows on top of each other, and you can focus on one specific window just by clicking on it.
You might, at least for now, get away with using some undocumented behavior where actors of a class are currently painted in the order they were added into the world (where the last one added is painted last -- or on top of the others). So, to have one moved to on top of others, save the world and
Constructor Overloading
By xbLank, with 5 replies.
Last reply by xbLank, almost 9 years ago:
Hmmm.. thats weird. Thank you tho!
How to make something happen the 1st time the world spawns in
By Bandito, with 3 replies.
Last reply by Bandito, almost 9 years ago:
That seemed to work thanks for your help as always!
Is the order of adding and removing similar Actors at the same location deterministic?
By MrBradley, with 7 replies.
Last reply by MrBradley, almost 9 years ago:
One Solution: To close this topic off for others who might be interested, I have taken the following approach: For an Actor you would like to impose an order on, use a serial # or ID field assigned by incrementing a static field. Change GF method call from getOneObjectAt(...) to getObjectsAt(...) Cycle through each element looking for the one with the largest (or smallest depending on removal order) ID, then use/remove that one. Thanks to both Dan and Davin for their suggestions.
Return Actor Name/Count
By xbLank, with 7 replies.
Last reply by xbLank, almost 9 years ago:
This is literally what I was asking for. Thank you.
ThreadAct / Update
By MrBradley, with no replies.
Davin, I've returned to ThreadAct after doing some work on my own, and I was wondering if you might like to work with me on updating it to use a MessagePump approach vs an array of sequences. I have a similar scenario where each actor places action messages (sequences) into a message queue, and has an associated thread that executes it and relinquishes control. The message queue is implemented using a BlockingQueue, and I was thinking of setting its size to one (1) and have that auto block until the next message appears in the queue. Another revision would be to use Functional Interfaces and lambdas for each action sequence (doRun). Let me know. Cheers
Place object relative to window
By benja24, with 5 replies.
Last reply by benja24, almost 9 years ago:
The menu shows information, i. e. polpulation and resources (stored as fields in the city that was clicked) and has some buttons to change those fields. I wasn't planning on uploading the project so a JFrame sounds like a interesting solution... Thank you!
What is this problem about? how to fix it?
By agiastaee, with 2 replies.
Last reply by danpost, almost 9 years ago:
Apparently, you make reference to a class named 'Title' that does not exist. You need to either create a new class with that name or remove the reference.
Grid
By Cirion, with 1 reply.
Replied to by danpost, almost 9 years ago:
You may want to see how I did my
MapWorld Superclass
scenario. You may even decide to use the MapWorld class in your project.
Incompatible Types
By Cirion, with 1 reply.
Replied to by danpost, almost 9 years ago:
The method call on the right side of line 5 does not return any value (it is a 'void' method). So, you are not assigning anything to the 'run4' variable on the left. Set the variable to a copy of 'run1' using 'new GreenfootImage(run1)', then mirror the new image on the next line.
Object should spawn randomly
By MetinPlays, with 17 replies.
Last reply by danpost, almost 9 years ago:
일리ㅏ스 wrote...
danpost wrote...
You probably just need one actor in the world from the following class: < Code Omitted > The only behavior given in this class is what you had indicated was needed. Any other behavior will have to be added as needed. And, of course, the class name can be modified as desired.
You are checking for 60 act iterations, not 60 seconds.
Yes, I am checking for 60 act iterations -- which is about 1 second -- not 60:
MetinPlays wrote...
I want one object of my game to spawn randomly on the field an remove
after 1 second
and spawn again somewhere ran
How to make Greenfoot Left click when "C" is pressed
By Rexsan, with 2 replies.
Last reply by danpost, almost 9 years ago:
More than where to put 'Greenfoot.mouseClicked(this)', wihich should be ANDed, using '&&", at line 21, is what to use in the 'delay' parameter, which should not be less than one (or rather should not be used at all and a timer should be introduced).
Static variable not resetting
By Diactaeon, with 3 replies.
Last reply by xbLank, almost 9 years ago:
danpost wrote...
Calling 'Greenfoot.stop()' does not in any way cause a branch in program execution. That is, it will not prevent the rest of the method from executing. Only a 'return' statement or a run-time error can do that. The 'stop' method only sets a flag that will be checked later (between act steps, I believe) to pause the scenario.
That is correct. I did not know that. But I agree with danpost. Check if you are using it in your act method. I don't think you are.
Graphics and HTML5 support
By Zamoht, with no replies.
Now that Java AWT isn't supported, does that mean we won't be able to render stuff using things like anti aliasing? How is the drawing even translated to HTML5 at this point, and will more rendering options be available in the future?
301
302
303
304
305
306
307
X