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
getNeighbours as movement pattern
By Drane, with 1 reply.
Replied to by danpost, over 9 years ago:
First thing you need to do is save the location of the player before the mouse drag starts. This is necessary so that (1) you can determine if the end drag location is one square away and in a cross pattern and (2) you can place the player back at that starting position if the end drag location is not valid. See what you do with it. EDIT: Using 'getNeighbors' will check multiple cells. Better is to check only the cell the player was dragged to once it is found to be at a valid location (using 'getObjectsAtOffset').
System.exit(0);
By Alex12, with 4 replies.
Last reply by danpost, over 9 years ago:
Alex12 wrote...
< Code Omitted > Greenfoot shuts down if I execute this code but restarts after a couple of seconds. Does anyone know the reason for that? -Alex12
You can use: <Code Omitted>to end the simulation. However, I believe you are trying to close the program totally by using the 'System.exit' command. I have not tested it, but, I think that this particular command will work as you had anticipated if the project was converted into a stand-alone application (an executable jar file), as the code is part of your project and not part of the greenfoot applicat
Follow Me on Greenfoot
By IHateMichaelKölling, with 2 replies.
Last reply by Gaming_100, over 9 years ago:
Nosson1459 wrote...
You shouldn't have labeled this discussion as a programming one.
Yes. Exactly
How to make a Simple counter
By Gaming_100, with 2 replies.
Last reply by Gaming_100, over 9 years ago:
You are the best! Thanks very much!
Adding health
By Childiish, with 12 replies.
Last reply by Super_Hippo, over 9 years ago:
Use the 'getOneIntersectingObject' for Dolphin and Bullet instead of the 'getOneObjectAtOffset' method. (Look at how I did it with the intersectiion with the Seal.)
How do I make a timer using Constructors? Please help
By IHateMichaelKölling, with 6 replies.
Last reply by Nosson1459, over 9 years ago:
At least its not against something, maybe instead aspiring to be superman he wants to be Super_Hippo.
Need someone to check for logic error
By Asiantree, with 2 replies.
Last reply by danpost, over 9 years ago:
Asiantree wrote...
For some reason, all of my Ants turn into DeadAnts after less than 3 seconds of runtime. Is there a logic error for my badCalorie and goodCalorie good in my Ant act method?
I took note of that
here
.
How to Change background mid game?
By crasnoml101, with 3 replies.
Last reply by danpost, over 9 years ago:
When setting an image to the background, greenfoot creates a new image. That is, using 'getBackground' never returns the same GreenfootImage object that you set to the background -- they
might
be equivalent, but not the same. This is for when the world set its background -- setting the image of an Actor object will set the same image and 'getImage' will return a reference to that image that was set to it. You can, however, make use of the counter for switching backgrounds:
Minesweeper game help
By BrownDwarf, with 1 reply.
Replied to by Super_Hippo, over 9 years ago:
I don't think that you should do the mine placement from the act method. You should do the creation of the mines and non-mines fields from the constructor. Why do you have this background class? I would do this: - add the 256 buttons - randomly choose 40 and set a variable in them to true (mine below) - when a button is clicked, show a mine or a number based on the variable and the variable from the neighbors
adding multiple rounds
By AAA355, with 1 reply.
Replied to by Super_Hippo, over 9 years ago:
In world Background: <Code Omitted>
getX not working.
By Alex12, with 7 replies.
Last reply by danpost, over 9 years ago:
Alex12 wrote...
Thank you very much. Never considered it could hang together with the speed. Thanks :) Could i try to check for it to be under f.e. 15?
You could check it to under any value; but to be equal to a value, you need to be more careful. You could use 2, 5, 8, 11, 14, 17, or 20.
import of jradiobutton and checkboxes
By divinity, with 6 replies.
Last reply by danpost, over 9 years ago:
divinity wrote...
the bread is the type of bread the user would order whether it is parmaesan bread, honey oats, wheat, teriyaki adn I was trying to add it using the add methods.
That would be a very general description of the bread which has nothing to do with how you are trying to code it. I mean, I now how to make a submarine sandwich and how to order one at Subway. My question was, basically, how (and where) did you declare the variable 'bread' in your code?
Global variable
By alinasomcutean, with 3 replies.
Last reply by alinasomcutean, over 9 years ago:
I need it because i need to move a girl the number of boxes which the die showed. And i want to do this the computer, not the person who plays. And it is repeted until you arrive at 29 from 1. Did you understand?
Help with removing Actors of the same class
By Asiantree, with 21 replies.
Last reply by Super_Hippo, over 9 years ago:
Why can't I jump on a block that created?
By Rex553, with 12 replies.
Last reply by Rex553, over 9 years ago:
Thank you so much!
368
369
370
371
372
373
374
X