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
Click Two or More Places
By meazalplaq, with 20 replies.
Last reply by danpost, about 11 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, about 11 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, about 11 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, about 11 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, about 11 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, about 11 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, about 11 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, about 11 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, about 11 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, about 11 years ago:
ok, thanks
help creating an Endscreen
By DesignerOrb362, with 3 replies.
Last reply by danpost, about 11 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.
Quick Question
By Nnacheta56, with 3 replies.
Last reply by danpost, about 11 years ago:
Nnacheta56 wrote...
Thanks, do you know Which Greenfoot class method allows you to move an object from one world to another world?
That would be a World instance method -- the 'addObject' method. The method will place an actor in the world whether it is already in a world or not (provided it is not already in the world you are trying to add it into). For example, if you had a Level1 world with an Actor mainActor, you can simply create a new world and add the actor into it: <Code Omitted>L
Help with this game...
By DesignerOrb362, with 4 replies.
Last reply by danpost, about 11 years ago:
The Explosion class of the lunar lander scenario is quite portable. You only need add the class to your project and create a new Explosion object when needed. You will need the 'explosion.png' image added to your 'images' folder of the scenario as well.
Treasure Hunt
By Mickey09, with 56 replies.
Last reply by inkpenKingpin, about 11 years ago:
Thanks for the help with this. As someone pretty new to this, the step by step was pretty helpful.
How can i create a order-based scoreb
By DesignerOrb362, with 3 replies.
Last reply by danpost, about 11 years ago:
Super_Hippo wrote...
If you only evaluate the number of laps by the sum of the rotation, then you could turn without driving the track and it is still handled as laps.
Yeah, I had thought about that -- like the vehicle spinning out of control racking up the lap count. I did not think that would be an issue here (though, I could be wrong). Using checkpoints is a good idea, however (just more code to deal with).
626
627
628
629
630
631
632
X