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
Problem with visualising multiple times during one act()
By 00swinter, with 1 reply.
Replied to by nccb, over 5 years ago:
You may want to try calling repaint() on the world after each step. By default Greenfoot only repaints after each act() round.
reference classes
By Patdumas77, with 2 replies.
Last reply by danpost, over 5 years ago:
rocket770 wrote...
If your Play Class is an object in the world you can reference it by this: Play play = getWorld().getObjects(Play.class).get(0); And now you should be able to access its attributes with for example play.PlayPause();
Typecasting is required for that assignment to be effective: <Code Omitted>
How to make an Actor(numbers of Actor) equal X?
By Kulo, with no replies.
So I made a zombie game where the zombies follow the Survivor(see below) but now I added the feature that zombies spawn and because of that the code has stopped working. So the question is how to make the Zombies equal X to make it work. Sorry for the bad desription. Thanks for your suggestions. <Code Omitted>
How do i have multiple levels?
By MrSkyPanda, with 1 reply.
Replied to by rocket770, over 5 years ago:
If you're checking a certain spot you can use it's X and Y Coordinates you can use this in your Character class: If(getX() == xlocation && getY() == ylocation){ Greenfoot.setWorld(new WorldNameHere()); } Where xlocation and ylocation are the coordinates of the spot you want to change the world. Alternatively, you can use an object that will change the world on collision. In your character class you add this line of code: If(isTouching(ObjectCLassName.class)){ Greenfoot.setWorld(new WorldNameHere()); }
Static int won't decrease.
By ItzLukeStorm, with 4 replies.
Last reply by Roshan123, over 5 years ago:
Welcome!!!!
getMicLevel does not work
By Mannu, with no replies.
In the Greenfoot book task 3.32 the method Greenfoot.getMicLevel should be used. While the sound-recorder and so my micrphone work, the method does not give any return value higher than zero. Can anybody help me to make the method work?
Making a png transparent
By Roshan123, with 9 replies.
Last reply by Roshan123, over 5 years ago:
I just wanted to know that is it possible to do something after drawing in the background of the world And i got the answer thanks to both of the genius!!!
How to achieve slow transitions ?
By Paul12345, with 3 replies.
Last reply by danpost, over 5 years ago:
Looks like you are trying to hog the CPU to slow down the execution. Well, if successful, you would only achieve what using delay would do -- slow everything down. Remove the method and post class that called it.
Greenfoot.Bee scenario
By Username123456789, with 16 replies.
Last reply by danpost, over 5 years ago:
Username123456789 wrote...
so it looks like this? << Code Omitted >> instead of "private void stats"
No. Utter confusion. Why would you have bee
lives
in the
Spider
class?
Greenfoot read file error window
By javaNewbie246, with no replies.
I have a program for my college final that I am having issues with, I have so far that on a key press, it should begin to read from a txt file for location information about birds and where to place them in the world, however when I press the key, I get a null error and a seperate error window pops up and simply repeats some method returns I have that state the birds health and infection count. if anybody knows what I have wrong please let me know. Below are the image of the error window and code I have that I believe to be in question.<Code Omitted>
Working wall
By iDragon3o6, with 3 replies.
Last reply by Gbasire, over 5 years ago:
You can do a simple thing to make some collisions in the player class, add this : <Code Omitted>it will basically check where you were the second before touching the wall and warp you back there
Can I create GUI for my game?
By Honza, with 10 replies.
Last reply by Roshan123, over 5 years ago:
mik. wrote...
And what for blue Its not working
Ohhhh.... It will never work becaz i never gave u the code for blue button If u have further more doubts then creat ur own discussion
How to use setVolume() to control volume?
By akiki, with 1 reply.
Replied to by danpost, over 5 years ago:
Apparently, you do not understand what it means when you make a class extend another (subclassing). A subclass is to describe the same type object as its parent class. Since a
VolumeUp
object is NOT a
Start
object, neither should extend the other. A subclass usually describes the object more precisely. The
Object
class is the root of ALL classes. Classes describe objects. The
Actor
class, which extends
Object
, describes any generic actor. All its subclasses will describe some actor type more specifically.
Actor
might be subclassed by
One Actor in multiple worlds
By JetLight, with 1 reply.
Replied to by RcCookie, over 5 years ago:
That’s no problem. Just use addObject to add the actor to the different world. It will automatically be removed from the old world, but all of its values will not be changed. You can simply add it back into the main world at a later point
Greenfoot shooting
By Xarloz, with 1 reply.
Replied to by danpost, over 5 years ago:
Well, you cannot use rotation of survivor as it is always zero. You cannot use the set image as you are creating new ones every act cycle. That, in itself is not good as image processing is a hog on CPU time. I noticed, also, that you are allowing 8-way movement, but only use 2 images. Your actor only looks left or right. Are those the only directions allowed for a projectile?
99
100
101
102
103
104
105
X