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
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, about 8 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, about 8 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, about 8 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, about 8 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, about 8 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, about 8 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, about 8 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?
Need help with Location of an object
By MetinPlays, with 3 replies.
Last reply by MetinPlays, about 8 years ago:
Ok I've made it, thanks a lot!
Keeping track of Multiple Actors in a Class
By xbLank, with 4 replies.
Last reply by xbLank, about 8 years ago:
Great way to look at it. Merry Christmas.
Adding my old move method but with new variables?
By Recorsi, with 5 replies.
Last reply by danpost, about 8 years ago:
In the overriding method add the following line: <Code Omitted>
help!
By agray11202, with 4 replies.
Last reply by Super_Hippo, about 8 years ago:
Either in the act method or a method which you call from the act method. There is nothing wrong about just putting it into the act method.
help!
By agray11202, with 2 replies.
Last reply by danpost, about 8 years ago:
agray11202 wrote...
is it possible to make an if statement when a certain object is touching a certain color???
Why not this: <Code Omitted>where 'touchingColor' returns a boolean value indicating the touching state. The parameters would be any information the method might need in order to make the determination on that state. So, the answer to your question is --- Yes. I really do not want to appear so blunt, vague or general about it; but usually, help can only be given in proportion to the amount of information provided.
Want to make my enemies shoot
By Kordus, with 2 replies.
Last reply by danpost, about 8 years ago:
If you were to put a comment on the 'canSee' method, it should read: <Code Omitted>The center being the location gotten from '(getX(), getY())'. So, the 'shootPlayer' method will need to use something else to determine when to fire. It will also need another condition to limit how often a projectile is fired when the player is in range. This can be a random chance thing or a regular or randomized timer.
300
301
302
303
304
305
306
X