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
I need help too
By Dominic, with 4 replies.
Last reply by Dominic, about 6 years ago:
oh thank you :)
Cannot find symbol - method getRGB();
By Ryaj987, with 2 replies.
Last reply by Ryaj987, about 6 years ago:
That did it!! Thank you
How would i make an enemy follow me
By Weeb.exe, with 2 replies.
Last reply by Weeb.exe, about 6 years ago:
danpost wrote...
Weeb.exe wrote...
Hi how would i make an enemy follow me and if they detected me they would shoot at me
Confusing. No codes. No attempt.
ok ill try and write a code to show you
NullPointerException?
By bubbadawg, with 2 replies.
Last reply by bubbadawg, about 6 years ago:
I am calling this as part of the constructor for one of my actor classes Edit: You're right. I moved that code to the constructor of my World subclass and it worked when I removed the "getWorld()." in line 6. Thank you!
we have some problems about the fifth scenario super turtel
By bram030, with 8 replies.
Last reply by bram030, about 6 years ago:
thank you guys for you help I will look tomorrow if the problem is solved
HELP
By hhh, with 1 reply.
Replied to by Kostya20052011, about 6 years ago:
The signs ==,>, < are only used in if. You also, if you want to check this condition it is necessary to do so: boolean z; z = getY() > getWorld().getHeight () -50;
I NEED HELP
By hhh, with 2 replies.
Last reply by hhh, about 6 years ago:
ive fixed it now but thanks hhh
Debug
By sillycilly, with 2 replies.
Last reply by RcCookie, about 6 years ago:
Just set a breakpoint and the debugger will open
I NEED HELP
By hhh, with 4 replies.
Last reply by danpost, about 6 years ago:
Kostya20052011 wrote...
I forgot to say that variables are declared before methods, and are used in the method itself, is this an error?
It's not an error. It is just not always necessary. If the variables are assigned new values and only used within the method during the current act step, then it is probably best to declare them within the method. Also, if the variable is only used one in the method, it might be best to use the method call to get the value at the time it is needed and forego declaring a variable for it at all. So, with this:
Is there any way to create a percentage in Greenfoot?
By Pistolenkrebs, with 1 reply.
Replied to by danpost, about 6 years ago:
Pistolenkrebs wrote...
So I wanted to create a Universal Paperclip-like game, and for that I want to exponentially raise the prices of certain objects/upgrades. Is there any way to do so?
Just raise the price by multiplying by one more than the percentage required. That is, to increase by five percent, multiply by 1.05 (or multiply by 105/100).
hi how would i create a timer for a pistol so if i shot i had to wait before shooting again?
By Weeb.exe, with 2 replies.
Last reply by Weeb.exe, about 6 years ago:
ok thank you
Just cannot figure out how to change worlds
By NotGoodAtThis, with 3 replies.
Last reply by danpost, about 6 years ago:
NotGoodAtThis wrote...
Solved that. I moved the world change code to an actor that sits on the world I want to move from.
There is an
act
method defined in the
greenfoot.World
class. You can override it (just like it is done in a class extending
greenfoot.Actor
) in your
TitleScreen
class. It is just not provided by the
World
subclass template as it is when you create a new subclass of
Actor
.
I am supposed to create a method that detects the nearest object (minnow) to another object (shark). The code seems to have some errors, but I am not able to compile it.
By Atharva1912, with 1 reply.
Replied to by danpost, about 6 years ago:
minnow
is of type
Actor
but,
nearest
is of type
Minnow
. You need to typecast
minnow
as type
Minnow
in order to set it to
nearest
. That is, line 13 needs to be as follows: <Code Omitted>Also, your method is supposed to return the nearest minnow; not the last one in the list.
double pendulum
By ronald, with 10 replies.
Last reply by ronald, about 6 years ago:
ok thank you
Using methods from another class
By resh47, with 1 reply.
Replied to by danpost, about 6 years ago:
In line 3, you need to typecast the world as a
GameWorld
object (just as in line 2). To avoid double work, you can set the world to an object reference variable prior to line 2: <Code Omitted>It allowed for the rest to be pretty short as one line, so I combined your lines 2 and 3 as my line 3.
132
133
134
135
136
137
138
X