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
NullPointer when referencing value from world in class
By nat12, with 4 replies.
Last reply by nat12, over 9 years ago:
Alright, well that's good to hear. Thank you once more.
Adding music to my game
By jacquelinereilly, with 8 replies.
Last reply by jacquelinereilly, over 9 years ago:
I got it, thank you
How to create a method that takes as parameter any object?
By dandrei279, with 4 replies.
Last reply by dandrei279, over 9 years ago:
Thanks! I'm going to try this.
How do I make my weapon semi-automatic?
By yungbae, with 2 replies.
Last reply by yungbae, over 9 years ago:
Super_Hippo wrote...
You could also use this as a condition: (in addition) <Code Omitted>
This works, thank you!
If class is touching class
By MrPancakes, with 8 replies.
Last reply by danpost, over 9 years ago:
MrPancakes wrote...
I can't run it here on my pc. Can you maybe help me with some code?
I can tell you that you will need at least four things:
a reference field for the actor that displays the bar
a control field for the value the bar is to display
a method to update the image of the bar both initially and when the control value changes
a method to change the control value that calls the method in the last item listed
These should go in, I would think (since it is a timer bar, sort of), in your World subclass.
Color
By Nosson1459, with 11 replies.
Last reply by Nosson1459, over 9 years ago:
Thanks. (That's better.)
getKey() doesn't work für the second instance
By Thom, with 14 replies.
Last reply by Thom, over 9 years ago:
The code-snippet of the KeyboardManager class is helpfully to understand the details. Thank you danpost.
Object out of balance
By Izzmemitch, with 55 replies.
Last reply by danpost, over 9 years ago:
Change 'LevelGauge gauge' in the prepare method to 'this.levelGauge' -- or, just drop that line and change 'gauge' in the next line to 'levelGauge' as a LevelGauge object is already assigned to the 'levelGauge' field. In the 'buttonPressed' and in the 'win' methods, 'n == 0' should read 'n = JOptionPane.YES_OPTION' for better readability. The first change above may do something about your gauge not moving.
Resizing pictures
By jacquelinereilly, with 4 replies.
Last reply by jacquelinereilly, over 9 years ago:
it worked, thank you!!
cannot find symbol - variable
By fonsemax, with 4 replies.
Last reply by Super_Hippo, over 9 years ago:
You don't call the 'eat' method from anywhere. You could put the following in line 14: <Code Omitted>This will work then, but it would probably be more clever to put the code into the Person class and check for touching the block instead of doing it the other way around as you did. I mean if you have your hand on a stone (in real life), would you say that you are touching the stone or that the stone is touching you?
Shooting only once
By nat12, with 1 reply.
Replied to by danpost, over 9 years ago:
You should use 'isKeyDown' instead of 'getKey'. Since it was spawning a bullet every act cycle, you just need to add an int timer to slow it down (so it can skip so many act cycles before shooting again).
Rotating object image and moving
By nat12, with 5 replies.
Last reply by Super_Hippo, over 9 years ago:
(Without the "private" obviously) Glad that I could help :)
If(getImage()==Image)...
By wolfyze, with 3 replies.
Last reply by wolfyze, over 9 years ago:
It works now. Thank you!
switch :: instanceof
By ZoeF, with 5 replies.
Last reply by danpost, over 9 years ago:
As an alternative, you can place 'cost' and 'imageName' fields in the superclass with methods to return their values; and then, you only need to set the values from the subclasses:
Bouncing Ball
By banana95, with 5 replies.
Last reply by banana95, over 9 years ago:
Thank you this helped.
409
410
411
412
413
414
415
X