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
How to make different enemy spawn if enemy is killed
By cloud41910, with 5 replies.
Last reply by cloud41910, over 10 years ago:
I got it now thanks for helping me out
Trying to use drawLine in world subclass
By CKnox, with 7 replies.
Last reply by CKnox, over 10 years ago:
Thankyou for that explanation danpost.
How to apply HealthBar
By cloud41910, with 76 replies.
Last reply by danpost, over 10 years ago:
Please ... new topic, new discussion -- and show what you tried.
Let an Object wait while the rest isnt waiting
By Sleeyz, with 1 reply.
Replied to by danpost, over 10 years ago:
Unless you are required to use a switch statement in your code, this method can be reduced to the following: <Code Omitted>To make it only process every other act cycle, you need to add a boolean instance field, change its value every act cycle and only process the code when the value is only either true or false. I change 'while' to 'if' because you do n
Click Two or More Places
By meazalplaq, with 20 replies.
Last reply by danpost, over 10 years ago:
meazalplaq wrote...
Is it possible to utilize an instance Boolean field to register whether a mouse click has occurred, and store that response? For example, if a mouse click has occurred in the Location_11.class, then when the user re-enters Location_11 again, remove Dialog_10.class and replace it with Dialog_11.class? Is there a way to do this?
Absolutely. A boolean field could be used to display two different dialogs, which may be fine in your case. You can display the second one over and over after the first or you could alternate between the two. On the other hand, you coul
Adding an object when key is pressed
By Kel123, with 8 replies.
Last reply by danpost, over 10 years ago:
Ok. Your problem is that 'getKey' will only return a keystroke once. If 'space' is pressed and is returned by 'getKey' in your world class code when checking for 'enter', then 'getKey' will not return 'space' when checking for 'space'. You can only feasibly use 'getKey' once during any act cycle (a cycle being the acting of the world and the acting of all objects in that world). Either you need to save the returned value in a field in the world class and check the value of that field when checking for 'space' in the other class, or you need to use 'isKeyDown' for one (or both) of them. Un
GameOver Screen Help
By hdeforest, with 1 reply.
Replied to by danpost, over 10 years ago:
You probably have a 'getValue' method in the counter class and can use 'scoreCounter.getValue()'.
Spent an hour on it, still can't figure it out
By Dillybar, with 3 replies.
Last reply by danpost, over 10 years ago:
In line 54, you have 'if
not
"d" down is false'. That could screw up the works (it is not similar to the code at line 26).
School project- create a whack a 'pig' game
By Korina, with 14 replies.
Last reply by danpost, over 10 years ago:
Korina wrote...
Some of the codes I don't understand the functions.
Do you know how to use the class documentation pages? Each class describes, in detail, what each member (field, constructor, or method) does. You can use it to trace from one class to another to find what you need or learn.
HowToKill
By Anne2403, with 5 replies.
Last reply by danpost, over 10 years ago:
danpost wrote...
Just add a check for touching the player
in the Fire act method
. If touching player, set a new GameOver world active.
I was quite specific in what I said here as far as where the code should go. Also, there is already an 'isTouching' method in the Actor class. Please review its documentation
here
.
Help with slowmotion timer!
By gamer98, with 6 replies.
Last reply by gamer98, over 10 years ago:
Thank you soo much, it fixed the problem.
Assistance with generating 4 actors in a random order.
By 0890289, with 5 replies.
Last reply by danpost, over 10 years ago:
Your code is equivalent to this: <Code Omitted>Briefly explaining, lines 3 and 7 of your code create loops that iterate through only once (after the first iteration, 'i' is incremented to 1 and the condition fails, causing the loop to terminate.
is storage available?
By Dalvengyr, with 15 replies.
Last reply by Super_Hippo, over 10 years ago:
NikZ wrote...
You could just ask the player, in the beginning before retrieving data, if their Java supports UserInfo. That way running it with 8 will still work. Of course, then there will be no high scores but at least it works.
That's the same as using 'if (UserInfo.isStorageAvailable())...'. With java 8 on the greenfoot site, it returns false.
Dalvengyr wrote...
Oh, what version is your Java if you don't mind? :)
7.71
I need some guidance on this Crab scenario.
By katebrown672, with 28 replies.
Last reply by sometechyguy01, over 10 years ago:
ok, thanks
help creating an Endscreen
By DesignerOrb362, with 3 replies.
Last reply by danpost, over 10 years ago:
danpost wrote...
If there are no more mushrooms in the world when the game is won, you can check for none in the world from your world act method and set a new Youwin world active when the condition is met.
I could not have explained it any more clearly.
625
626
627
628
629
630
631
X