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
How to read multiple tokens in scanner input?
By Zweeg, with 1 reply.
Replied to by danpost, over 6 years ago:
I am guessing you want to combine the genre with the description. Please confirm. Also, show the code lines used to create this Scanner object.
Unable to find Method?
By Legitimacy, with 17 replies.
Last reply by danpost, over 6 years ago:
Legitimacy wrote...
I reinstalled Greenfoot and it still didn't work. I also installed Greenfoot on my laptop and tried to open the project on that and it didn't work either. I tried opening a previous version of the program which was working perfectly and it has the same issue. I also tried copy and pasting all the code from what I pasted into my previous message and it did not work. Any ideas?
Sorry, ideas are not fresh, at this point.
I am Making a snake game and cant get the code to work in my snakehaed, snakebody or snake world classes.
By zach0531, with 2 replies.
Last reply by danpost, over 6 years ago:
Try removing <Code Omitted>from all your classes and add a Point class to the project: <Code Omitted>
Increase cost and add for counter.
By MemThef, with 1 reply.
Replied to by danpost, over 6 years ago:
Maybe you should have a purchase price field in the Arrow class and add a parameter to the Arrow constructor to pass the value to it. That way. each arrow will be able to calculate how much to add to the counter (based on its cost).
Gravity doesn't work
By CoolSharkCody, with 19 replies.
Last reply by CoolSharkCody, over 6 years ago:
It worked. Thanks!
Random apperances
By dylanriccio8998, with 2 replies.
Last reply by dylanriccio8998, over 6 years ago:
thank you so much
How to scroll through an arrayList like a conveyer belt?
By Zweeg, with 1 reply.
Replied to by danpost, over 6 years ago:
Zweeg wrote...
I want to scroll forwards and through an arrayList every time I press the ">" key. I can do this no problem but the problem is when I reach the end of the arrayList. When I reach the end, I want to go back to the front. This sounds confusing but really the concept is simple. For example, let's say we are displaying the arrayList slots 1,2,3,4 of an arrayList size 5. When I press the key ">" I want to display the slots 0,1,2,3. When I press the key ">" again, I want to display slots 1,2,3,4. Hopefully this example clears things up.
For one at a time, use:
problems
By ebollinger@sonorahigh.net, with 10 replies.
Last reply by danpost, over 6 years ago:
ebollinger@sonorahigh.net wrote...
i just need to know how to center the shop in the mittle
You mean this? <Code Omitted>
How to make an actor exit into another actor from certain points?
By Zaki99, with 3 replies.
Last reply by Zaki99, over 6 years ago:
I have try doing different if and else statements with a Boolean but none of them work.
how to add set actors in fixed positions in the world
By TobyRoby, with 2 replies.
Last reply by TobyRoby, over 6 years ago:
ah, I didn't see that at the top, I thought there was a function you had to put in the world clas. Thank you :)
Need help with Maze/Color detection
By Pyralis, with 1 reply.
Replied to by danpost, over 6 years ago:
Pyralis wrote...
I'm in the process of making a maze game. I've tried every kind of color detection code that I could find. All aren't working for me. I have a actor that is my maze and an other actor as my player character. Everything I've tried to do to stop you from being able to walk through walls hasn't worked.
Possible solves (from easiest to hardest): * if, walls or paths are a flat color, use that color in your collision detection; * if wall or path are favored with much more red, green or blue, you can use that in your color detection; * otherwise, add Wall actors or Path
if statement not working
By Recorsi, with 1 reply.
Replied to by danpost, over 6 years ago:
Recorsi wrote...
Why does this work: << Code Omitted >> but not this: << Code Omitted >>
Not enough information or code given to determine what may be going on.
why setImage doesn't work?
By Actle, with 8 replies.
Last reply by Actle, over 6 years ago:
danpost wrote...
Actle wrote...
how?I thought for a long time but couldn't come up with the answer.
Add a constructor to the class and initialize the zombies through code there. You will probably need a static int counter to track which zombie is being created:
game over image not displaying
By hmhmhn, with 4 replies.
Last reply by danpost, over 6 years ago:
hmhmhn wrote...
my Gameover class does not have any code as im just using it as an image. before the delay the game will just reach 8 points, that will start the delay, during the delay of 2 seconds I want my gameover image to be shown on the screen and once the delat of two seconds is over the game will restart
You will need some code in your GameOver world. At least something to set a new PongWorld object active. The delay should probably be in that class also: <Code Omitted>
Identify an actor
By misg, with 1 reply.
Replied to by danpost, over 6 years ago:
misg wrote...
how I can identify an actor? Let us assume there are 4 actors of the same in the world. How can I know and identify what is the 1,2,3 and the 4th of them? Is there a chance to have an activity if the actor is the actor number 2?
You could list them or give each a unique state; otherwise they would not be essentially identifiable. There may still be a way that could work; but it is not guaranteed to work in future versions of greenfoot. An undocumented behavior in the way greenfoot lists the actors that are placed into a world may be used to identify a specific actor.
223
224
225
226
227
228
229
X