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
Random Attack help
By CH1, with 5 replies.
Last reply by danpost, almost 7 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, almost 7 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, almost 7 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, almost 7 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, almost 7 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, almost 7 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, almost 7 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, almost 7 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, almost 7 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.
greenfoot导出的jar文件
By 旧城梦, with no replies.
错误: 找不到或无法加载主类 greenfoot.export.GreenfootScenarioApplication 原因: java.lang.NoClassDefFoundError: javafx/application/Application 请问这个问题,有人可以帮助一下吗?
greenfoot导出程序jar怎样运行?
By 旧城梦, with no replies.
在Windows 10,怎样将jar文件打开
Trouble with background
By Al3x7373, with 36 replies.
Last reply by danpost, almost 7 years ago:
Remove those two lines you just added. Below in '
public Sky()
', modify these lines: <Code Omitted>
Is there a way to press a button and have the program quit completely?
By TylerBlair, with 1 reply.
Replied to by danpost, almost 7 years ago:
TylerBlair wrote...
I was wondering if there was a way that a user can press a key and then have the program quit. I know how the keypress works but I am just looking for what would come after that.
I think you want: <Code Omitted>
Getting a Variable from a Different Subclass
By Haylaylo11, with 4 replies.
Last reply by danpost, almost 7 years ago:
Haylaylo11 wrote...
As of right now, in the second segment of code, level is just returned as 0 instead of what the user inputs.
In liine 4, what does 'level.getLevel()' do?
158
159
160
161
162
163
164
X