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
Add Life when Heart is removed
By suge5, with 11 replies.
Last reply by danpost, over 8 years ago:
Okay, I was thinking the check for click was in the FrogHitter method -- apparently not; and I did not (and still do not) see anything detecting a mouse click in the Life class. Wait, I remember, it was in a FrogHunter class. Just remove the 'FrogHitter();' line from the Life class.
How can I assign a method to One Specific Object of one class?
By LoopingSample, with 3 replies.
Last reply by LoopingSample, over 8 years ago:
OMG I love you right now - it worked! Thanks so much, saved me and my friend a couple of hours of thinking. Sometimes it's easier than it seems :D
Wrong value
By alinasomcutean, with 10 replies.
Last reply by alinasomcutean, over 8 years ago:
You are right, because I observed that more than one value is displayed after the instruction "System.out.println(nr);" is execute once. What can I do to freez its value, so when "space" is pressed to keep only one value which will return?
health bar and game over
By Randalini, with 1 reply.
Replied to by danpost, over 8 years ago:
Randalini wrote...
I need some help for programming a health bar and a game over screen. I need a health bar for my player and one for my enemy which regenerates 1/10 if he eats. The game over bar should appear when the heart bar is on 0 Thx ^^
My
Value Display Tutorial
explains how to create usable health bars and heart bars. The game over screen can be just a separate World subclass that is instantiated and activated when needed.
Help java.lang.NullPointerException: String is null
By CodeBoy, with 2 replies.
Last reply by davmac, over 8 years ago:
Can somebody please tell me what is going wrong.
Your "Word" variable is never getting set to any value, so it contains null (no object). When the following line runs: <Code Omitted> `Word' is still null, so this is an error. You must supply an actual string to the drawString method (even if it is the "empty" string; that is still different from no string at all!). Danpost's suggested change should solve the problem.
non-static method cannot be called in static context. Can anyone help me?
By CodeBoy, with 2 replies.
Last reply by CodeBoy, over 8 years ago:
Thank you my score class is working now.
How to make the world move
By 陳映璇, with 1 reply.
Replied to by danpost, over 8 years ago:
Scrolling is discussed
here.
How to make an obstacle
By 陳映璇, with 1 reply.
Replied to by danpost, over 8 years ago:
Usually, the actor is moved, then if found intersecting an obstacle, it is moved back off it. Very basically, something like this: <Code Omitted>
Emboss Image
By ironphoenix20, with 3 replies.
Last reply by Yehuda, over 8 years ago:
I don't know how to emboss an image with code, but the method you have above just creates an image then returns it. On lines 5 and 6 you create an image with the same dimensions as the one specified, then on line 56 you return it - you don't do anything with it in between. I don't know if this method can work at all since I haven't tried it but maybe if you change the 'bi's to 'dst's it will work (besides for lines 1, 2, and 3).
Different Sound For Each Object When Removed
By suge5, with 4 replies.
Last reply by suge5, over 8 years ago:
Thank you
Embossing Image
By ironphoenix20, with no replies.
Anyone know how to emboss an image by manipulating each pixel of a BufferedImage?
Error
By alinasomcutean, with 2 replies.
Last reply by alinasomcutean, over 8 years ago:
Thank you!
Player 1 and Player 2 same code but only Player 1 works
By Lan31, with 3 replies.
Last reply by danpost, over 8 years ago:
The problem is the use of 'getKey'. You are using it for two different things within one act step. The only time the second call to it returns the same as the first is when it returns 'null'. Otherwise, when the first time does return a key, the second time will return either 'null' or a different key (if more than one was registered before a call to 'getKey' was able to get the first). You will need to track the state of the keys ("c" and "space") in their respective classes and determine when the state of each changes (using either the press or the release of the key as the condition to
how to keep health between worlds
By FutureCoder, with 22 replies.
Last reply by FutureCoder, over 8 years ago:
i took the line out when it didn't work, but i had used Character character = new Character(); addObject(character, 598, 488); so it didn't work, but now it works great, thank you so much!
How do I use methods from the World?
By Unknown6415, with 3 replies.
Last reply by Unknown6415, over 8 years ago:
Oh yes thanks, I found the exact same way you wrote I time ago in another discussion This works, thanks
350
351
352
353
354
355
356
X