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
My code is adding Infinite objects while I only want to add one
By madeirense, with 2 replies.
Last reply by Super_Hippo, over 10 years ago:
You execute the verificanivel-method twice each act-cycle. And if there is no asteroid (of any type) and no ship2, it spawns a portal at random position. After adding the portal to the world, you check if there is a portal in the world to see if you can advance to the next level. Of course there is a portal in the world (it was just added). In the next execution of the method, the condition is still passed and a new portal is added. You could merge line 11 into line 5, so you only add one. Lines 11-14 can be removed then. Then you can check an intersecting with the portal in the Ship class
How to export to android?
By zxLanslot, with 1 reply.
Replied to by Super_Hippo, over 10 years ago:
There is a project called droidfoot. The developer tried to copy Greenfoot into Eclipse. From there, you can play your games on your smartphone. However, I tried this with some of my games and they weren't playable because of too much lag.
How to access an int value from another actor?
By madeirense, with 6 replies.
Last reply by Super_Hippo, over 10 years ago:
Ok, the reason why no power up is spawned is that the score isn't always increased by 1. So if the score if higher than 1000, 'score==1000' isn't true. You can change the line to this: <Code Omitted> But with this, there is a new power up created every time the score is increased after reaching 1000. So you could add a boolean like this: <Code Omitted> If you want to to add a new power up every 1000 points for example,
Instruction
By Zakki1, with 3 replies.
Last reply by Super_Hippo, over 10 years ago:
To make it disappear from another class, you can use this: <Code Omitted>
Title page
By Zakki1, with 1 reply.
Replied to by danpost, over 10 years ago:
My
Super Level Support Class
scenario demonstrates how this can be done.
How do you make an actor follow another actor?
By luke6728, with 2 replies.
Last reply by BatteryBot, over 10 years ago:
You can use the coordinates of the actor to determine if he has to move over the x or y shizzle
How to ignore transparency in Actor images.
By iansprograms, with 2 replies.
Last reply by iansprograms, over 10 years ago:
danpost wrote...
Not only is some of the image transparent, but it has grass image that hides with the ground. You could do one of two things (that I could think of) to limit the action to the crystal image itself. One way is to add hitbox objects into the world that will check for the clicks; the other is to test the color at the location of the click on the crystal.
The grass that's hiding with the background is fine, I meant it to be there. I will try the hitbox idea first, it seems easier than checking for the color. Thanks!
Tranferring a project on Greenfoot to BlueJ?
By msasashi23, with 1 reply.
Replied to by luke6728, over 10 years ago:
IDK
Help with sorting array of numbers?
By Dylan1999, with 3 replies.
Last reply by danpost, over 10 years ago:
The following line should sort the array: <Code Omitted>
How To Create Mute Button
By Yuki, with 5 replies.
Last reply by Super_Hippo, over 10 years ago:
Use the first line outside methods. Then you can use 'backgroundMusic.pause();' to pause it. <Code Omitted>
Shooting Help
By Robert2.0, with 11 replies.
Last reply by Super_Hippo, over 10 years ago:
There is a closing brace ')' missing.
Please, help
By Makhil, with 2 replies.
Last reply by Makhil, over 10 years ago:
Thank you very much
my counter aint increasing
By Nischaya, with 1 reply.
Replied to by danpost, over 10 years ago:
You have 'int pizzas = 0;' inside the act method as a variable whose scope (existence) is maintained while the method is executing. Each time the method executes, a new 'pizzas' variable is created and when the method is done executing, the variable is gone for good. To maintain the variable for a longer period of time (for the life of the Nischaya object), that line needs to be placed outside of the method.
How can I modify an "int" from another Class?
By madeirense, with 3 replies.
Last reply by danpost, over 10 years ago:
madeirense wrote...
Still crashing, java.lang.NullPointerException at PowerUP.act(PowerUP.java:44)
Switch lines 6 and adjusted line 7 above (remove the powerup from the world after adjusting the value of PUP).
Loop that creates 10 new instances
By edwards_38, with 1 reply.
Replied to by danpost, over 10 years ago:
Sounds like two issues here. Please stick to one issue at a time and show what code you have tried (try something).
480
481
482
483
484
485
486
X