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
Need help with picking up and dropping objects
By cxthleen, with 3 replies.
Last reply by danpost, about 11 years ago:
If the pick-up and drop-off actions were done instantaneously, then there are only two states for the ambulance -- unoccupied and occupied. If these actions (especially the picking up) take time to accomplish, then there are four states -- unoccupied, loading, occupied and unloading. You will need to keep track of what state the ambulance is in. The actions to be done during each state can be programmed depending on the specific state the ambulance is in.
Can someone help us with our game Chain Factor?
By IsabelSchouten, with 1 reply.
Replied to by Super_Hippo, about 11 years ago:
No one will program the whole game for you. You can ask for help if you need help with a specific issue. Do small steps and you will find out that it won't be as difficult as you may think when seeing the whole game.
How can you change the following (I can find no solution)?
By Windows10, with 1 reply.
Replied to by danpost, about 11 years ago:
Where is your code? what commands do you use to make the car move? what are the name of your classes? what parameters are used to create your world? what have you tried? It is easy to ask a simple question; but, the only answer that can be proffered with what was given is -- "Use 'if' statements. Beyond that, one would have to guess as to what information you left out.
How can I ask up the value of a variable while in another class?
By Ann, with 1 reply.
Replied to by danpost, about 11 years ago:
To begin with, using 'Object' as a subclass of anything is not recommended. The Object class is the root class of everything. Refer to the
Object class API documentation
. Next, why not place to code to heighten the jump when touching the object in the Hero class. By the way, increasing the height of a jump involves decreasing the jumpHeight field because it is a negative value. In the Hero class, you would only need to check for one of these objects when a jump is being made, applying its extra force at that time
How can I retrieve the value of a variable while in another class?
By CompT, with 1 reply.
Replied to by danpost, about 11 years ago:
CompT wrote...
Refer to
this
.
Help!
By LJE516, with 1 reply.
Replied to by danpost, about 11 years ago:
Do not assume that the issue is a greenfoot issue. This appears to be a issue with lack of knowledge of constructors in subclasses. First thing is that you are missing a set of round brackets after the class name in creating a 'greenRat' object. Change line 3 of your 'initializeChess' method to: <Code Omitted>Class names, by convention, should start with uppercase letters -- so, 'GreenRat' would be conventional; not 'greenRat'. Now, you did not supply any code from the greenRat class -- but you need a constructor in it that will inform the Chess class wha
Enemy hit reaction
By Genora51, with 10 replies.
Last reply by danpost, about 11 years ago:
As far as where you are using
try
now: Line 22 probably was because you were getting indexOutOfBounds exceptions. Change lines 20 through 24 to: <Code Omitted>You were starting one row off the image to the right and below where no color can be (hence the exception). Line 43 would not throw an exception unless the enemy was not in the world when the
hit
method was called (illegalStateException). The method can be changed to this:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
By Vellyxenya, with 4 replies.
Last reply by Vellyxenya, about 11 years ago:
I see, thank you very much for your help! :)
object pick up
By javastudent, with 3 replies.
Last reply by danpost, about 11 years ago:
I would suggest you control the object being picked up from the class of the object picking it up. If you code it in the class of the object being picked up, then any and all objects that can be picked up will act independently and you could have multiple objects picked up at one time.
Pop-up Message
By ctgreenfoot, with 8 replies.
Last reply by kev, about 11 years ago:
danpost wrote...
Create a sub-class of Actor called 'GameOver':
Help me with my code
By kalayamosu, with 4 replies.
Last reply by davmac, about 11 years ago:
If you're still stuck, read
this page
, especially the section titled "I don't know where to start!"
trouble with collisions and movement
By pleasehelpme, with 3 replies.
Last reply by danpost, about 11 years ago:
pleasehelpme wrote...
i don't get the null part ... this is what i have so far.. < Code Omitted >
The code you have shown would be fine if the Person object was never going to be dropped off at some later time. However, more than just whether the person is touching an ambulance or not is needed for what you want (especially for the dropping off -- where the person would still be touching the ambulance after being dropped. From what I can tell from what you have given, the Person objects are just placed into the world and stay in one place until an ambulance arrives at its location (t
How to add black piano keys
By 4SeaBass, with 1 reply.
Replied to by danpost, about 11 years ago:
Sounds like you are setting the initial image in the act method instead of in the constructor of the Key class.
trouble with collisions and point systems
By kevtie, with 2 replies.
Last reply by kevtie, about 11 years ago:
Thank you and thank you for reading
Question about getting an actor to traverse entire grid
By dasav, with 6 replies.
Last reply by dasav, about 11 years ago:
danpost wrote...
dasav wrote...
ok so it would be better if I made the movements outside of the else statement?
No. I think you should not move within the 'else' part before checking to see if it can. In other words, within the 'else' part, check to see if it can move before moving.
ok thanks that makes more sense. I will try to fix that and post my results. Thanks for all your help
530
531
532
533
534
535
536
X