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
Gravity doesn't work
By CoolSharkCody, with 19 replies.
Last reply by CoolSharkCody, about 7 years ago:
It worked. Thanks!
Random apperances
By dylanriccio8998, with 2 replies.
Last reply by dylanriccio8998, about 7 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, about 7 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, about 7 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, about 7 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, about 7 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, about 7 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, about 7 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, about 7 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, about 7 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, about 7 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.
Kaden this is for you
By Hitman735, with no replies.
<Code Omitted>
HEALTH COUNTER GOES DOWN WHEN MONSTER NOT TOUCH THE GUY
By ErnieBoi, with 5 replies.
Last reply by ErnieBoi, about 7 years ago:
ˢᵒʳʳʸ ᵈᵃⁿᵖᵒˢᵗ ᵗʰᵃⁿᵏ ʸᵒᵘ ᶠᵒʳ ᵗʰᵉ ʰᵉˡᵖ ᶦ ᵃᵐ ᵉʳⁿᶦᵉ
How to end a game when a specific score is reached?
By hmhmhn, with 5 replies.
Last reply by danpost, about 7 years ago:
hmhmhn wrote...
<< Code Omitted >> I just don't know how to make the game stop at 8 points, because ive used strings for the score im guessing I have to do it in an act method in the world class??
I am not sure what you mean by "ive used strings for the score". The
getValue
method of the
Counter
class returns an int value which is a score. Best places to check for game over is when you add to the scores (lines 47 and 53 of your PongWorld class).
Problems converting between greenfoot.Font and java.awt.Font
By tonyreks, with 1 reply.
Replied to by danpost, about 7 years ago:
I came up with the following test class code which seems to work:
224
225
226
227
228
229
230
X