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 can I save a score and present it at the end screen?
By TylerBlair, with 1 reply.
Replied to by danpost, over 6 years ago:
I do not see where any
EndScreen
world is being created.
step on actor and another one need to disappear
By svenfrijters, with 6 replies.
Last reply by svenfrijters, over 6 years ago:
thx a lot
Greenfoot 3.6.1 released
By nccb, with no replies.
A quick announcement that Greenfoot 3.6.1 is out. You can
download it from the usual place
. This is a bug-fix release that fixes several issues in Greenfoot, including one where Greenfoot could lock-up and not reset properly. More details on the bugs are in the
version history
Exercise 10.48.
By dROS, with 7 replies.
Last reply by danpost, over 6 years ago:
Each time the
MusicUp
button is clicked, a new instance of
Music
is created. The
Music
class is def not designed in any type of "singleton" pattern.
actor losing lives not working
By MsWoof, with 3 replies.
Last reply by danpost, over 6 years ago:
danpost wrote...
You can execute the last two methods given above in your
World
subclass from the
Mario
class just like you call the previous method from the
Mario
class.
Lines 4 and 5 of your new code does not make use of the last two methods I had suggested you use.
Random Attack help
By CH1, with 5 replies.
Last reply by danpost, over 6 years ago:
From what I can tell from what was given,
getRandomNumber
appears to be an undefined variable. Also, the expression for the
if
condition looks to be an
int
value, not a
boolean
one (which is required for a condition). Another problem is the previous line which is just a loose
int
value -- it is like coding a line like: <Code Omitted>or <Code Omitted>(both uncommented) which is really equivalent to <Code Omitted>a non-operative statement. Create a local int variable and assign the random value to it:
Option box
By Chase, with 1 reply.
Replied to by danpost, over 6 years ago:
Chase wrote...
hey, I'm making a game that inorder to go to other locations you click on one of 2 boxs... for an example, your in a room and you have two box's, one says go left and one says go right. problem is I have no clue how to make these...
Basically, you are wanting to make two buttons, which are, in essence, text display actors that clicks are detected on. Please refer to my
Value Display Tutorial
scenario.
Visible object
By Paciman, with 1 reply.
Replied to by danpost, over 6 years ago:
Paciman wrote...
Is it possible if two object are on the same place to choose which object hides behind the other ?
Yes -- and no. The
setPaintOrder
method can be used to have ALL of one type object showing over ALL of another type. Otherwise, there is no documented way of doing it. Currently, however, objects more recently added into the world will show over those objects already in the world. This means you can take an actor and remove and re-add it into the world to have it show above another actor.
Fire class appears before BlueCar reaches X axis
By suzbo, with 4 replies.
Last reply by danpost, over 6 years ago:
suzbo wrote...
Fire class appears before the BlueCar reaches the location of the X axis
With what you have given, I cannot see any reason for what you say is happening. The only strange thing I see (which I cannot expect to be related to your issue) is the exclamation mark inside the filename of the image -- and that may be fine, as is.
Bow Shooting
By insurqassable, with 1 reply.
Replied to by danpost, over 6 years ago:
Remove the counter and add a
boolean
to track the state of the "space" key. Check for a change in the state of the key by comparing current state to previous state (held by field). When a change is detected, update the field and check its new value to determine when to shoot.
exporting scenarios
By TakedaYeet, with no replies.
I finally finished a very simple game where a spider attempts to eat ants. I wanted to save it as an .exe file and found out that you had to save as a .jar file, and compile it into a .exe file.when I export it, it saves as a win.rar file and I can't find the .jar file or anything similar. the only thing I could find is png files, text files, and things of that nature. if there is a way to export it please tell me. thanks in advance.
Problem with press key
By Paciman, with 4 replies.
Last reply by danpost, over 6 years ago:
Paciman wrote...
Could you maybe explain just the code you just wrote down. I would really appreciate i dont like writing things I don't understand
The first line was moved outside the method so the values can be retained (not reset every time the method is called). The second line was added to track the (last known) state of the "space" key. Line 6 checks to see if the state of the key had changed (either just pressed or just released). Line 8 updates the tracking field when a change in the state of the key is detected. Line 9 reverses gravity if the new state is the down state (ju
setImage doesn't work in World subclass
By BkS, with 2 replies.
Last reply by danpost, over 6 years ago:
Actors use
setImage
and worlds use
setBackground
. However, I doubt you want this particular image to be tiled on your world's background. You probably should create an actor, give it this image to use and add it into the world. Another option is to use
setText
on the world; however, then you will not be able to control color, font and size.
World not instantiating
By genju, with 3 replies.
Last reply by genju, over 6 years ago:
the problem is fixed now, i did the commenting thing but that wasnt what fixed everything.. for some reason i just needed to right click the class in the main screen and click new StartWorld(). not sure why that happened but atleast now i know what to do in case it happens again, thanks for the quick response dan
How can i push an object?
By svenfrijters, with 3 replies.
Last reply by danpost, over 6 years ago:
In what class is the code given placed into? Line 3 looks like it takes an object of one type and places it in a field that holds a different type.
157
158
159
160
161
162
163
X