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
Why does this cause an IllegalStateException?
By davkri22, with 2 replies.
Last reply by davkri22, over 6 years ago:
Nevermind, the error was really coming from my tower constructor but greenfoot did not show me.
My Checkmarks won't go away
By Chris498, with 9 replies.
Last reply by danpost, over 6 years ago:
Chris498 wrote...
But is the
while
loop the problem? Because if not, i would prefer to keep the code to things that I fully understand
It is not down-right wrong. It is just more CPU extensive because you unnecessarily repeat a process that does not have a need to do so.
how could i make a health bar without a counter
By SanjiNaha, with 4 replies.
Last reply by SanjiNaha, over 6 years ago:
when the guy punches the other guy it should change, not randomly thanks
If i want to remove a object when it touches the World Edge the game crashes
By BimBom46, with no replies.
<Code Omitted> When it crashes, it says : java.lang.IllegalStateException: Actor not in world. An attempt was made to use the actor's location while it is not in the world. Either it has not yet been inserted, or it has been removed. Under that are two red marked text : at Bullet.Spielerentfernen1(Bullet.java:26) at Bullet.act(Bullet.java:21)
For Jak
By SanjiNaha, with no replies.
i kill turtle bois if(isAtEdge()) { World MyWorld = getWorld(); MyWorld.removeObject(this); } else if(isTouching(Pxl2.class)) { World MyWorld = getWorld(); MyWorld.removeObject(this); } else if(isTouching(Wall.class)) { World MyWorld = getWorld(); MyWorld.removeObject(this); } else if(isTouching(Ball2.class)) { World MyWorld = getWorld(); MyWorld.removeObject(this); }
The Object is not getting removed
By BimBom46, with 1 reply.
Replied to by Super_Hippo, over 6 years ago:
Do you call the method from your act method?
what is wrong wit my code?
By SanjiNaha, with 5 replies.
Last reply by danpost, over 6 years ago:
SanjiNaha wrote...
<< Error Trace Omitted >>
That error was not produced with the code given above. What is your revised code that this came from?
Need help
By N1C0, with 1 reply.
Replied to by danpost, over 6 years ago:
N1C0 wrote...
i want to create two objects with a delay of 5000 in between << Code Omitted >>
Is the entire scenario to be paused until both are created? If not, then you cannot use the
delay
method. you would need to use an int timer field.
Numbers keeps increasing
By trevo, with 9 replies.
Last reply by danpost, over 6 years ago:
trevo wrote...
And the numbers represent which target it goes to. I couldn't figure out how to make it stop increasing.
If the target for a projectile is fixed, why did you add lines that change the number?
Saving the world moves objects
By Tietie12, with 8 replies.
Last reply by danpost, over 6 years ago:
Tietie12 wrote...
i know it is possible to continue with this method but it makes it incredibly slow opposed to not having too
Makes what slow -- the running of the scenario or the coding of it?
Greenfoot bug or am I dumb?
By CarolK, with 2 replies.
Last reply by CarolK, over 6 years ago:
Ok, so it was the second option... Thank you! I can not believe I forgot about it
Collecting 3 key, avoiding enemies, and creating a labyrinth
By Jaisdreval, with 1 reply.
Replied to by danpost, over 6 years ago:
This
tutorial page has a section on
Saving the World
, which allows your actors to be immediately initialized.
getWorld().removeObject();
By NotAProYet, with 9 replies.
Last reply by NotAProYet, over 6 years ago:
Many many thanks! It is working just perfectly!
object spawner
By mercury, with 1 reply.
Replied to by danpost, over 6 years ago:
mercury wrote...
I am making a version of asteroids for a project how do I make an object spawner to spawn the asteroids
Your world is an object which can spawn actors into itself. Add an act method to your
World
subclass.
Starting Rotation
By AdiBak, with 3 replies.
Last reply by danpost, over 6 years ago:
@Archerfish, the general equation is: <Code Omitted>I am surprised you missed the "+1" immediately after stating why "121" was used.
150
151
152
153
154
155
156
X