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
Help with averaging a string/array of numbers?
By Dylan1999, with 7 replies.
Last reply by danpost, over 9 years ago:
Dylan1999 wrote...
Okay, I'm no longer getting an incompatible type error nor a syntax error. However, I'm getting an Out of Bounds error with: < Code Omitted >
Well your iterator is being used for indexing, not for the number itself (as I had used it for above). The 'for' line should be: <Code Omitted>and the 'drawstring' line should be outside the loop (after the next closing squiggly bracket) and should display something like "The average value of the "+numbers.length+" numbers is "+(sum/numbers.length)
Strange keyboard behavior
By TinyTertle, with 4 replies.
Last reply by TinyTertle, over 9 years ago:
I really like the idea of keeping the down keys in an array! This should work. Thanks for the help!
How can I remove drawn lines?
By TinyTertle, with 4 replies.
Last reply by TinyTertle, over 9 years ago:
Haha, yeah I'll definitely just stick to wrapping the image into an Actor object. I appreciate the time and effort though!
Public boolean help?
By OrientalCarpet, with 5 replies.
Last reply by danpost, over 9 years ago:
OrientalCarpet wrote...
I am using an actor subclass for it
You could ask if the world has the title screen showing or not with something like the following in the World subclass act method (I will call your actor subclasses TitleScreen and GameOver): <Code Omitted>The will cause a ball to spawn only while the game is in progress. If the title screen actor or the game over actor is in the world, or a ball is already in the world, no
This may seem like a stupid question but how do you save music and images on Mac?
By Coolguyawesome2, with 1 reply.
Replied to by danpost, over 9 years ago:
Your project folder should have two sub-folders within it. One, called 'images' (to hold the images for that project) and one called 'sounds' (for any music or sound files for the project). Sound files need to be moved into the 'sounds' folder using your file browser; but, images can be imported (right click on the class and select 'setImage...' and click the 'Import from file...' button to browse.
Greenfoot objects touching in world
By thmysdar, with 4 replies.
Last reply by thmysdar, over 9 years ago:
THANK YOU SO MUCH
My code is adding Infinite objects while I only want to add one
By madeirense, with 2 replies.
Last reply by Super_Hippo, over 9 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 9 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 9 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 9 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 9 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 9 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 9 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 9 years ago:
IDK
Help with sorting array of numbers?
By Dylan1999, with 3 replies.
Last reply by danpost, over 9 years ago:
The following line should sort the array: <Code Omitted>
478
479
480
481
482
483
484
X