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
Programming of a ghost in pacman
By annika.g, with 1 reply.
Replied to by Super_Hippo, over 6 years ago:
You can check my Pac-Man game here:
https://www.greenfoot.org/scenarios/19573
It is pretty similar to the original one and you can view the source. However, it is mostly in German. The code for the ghosts is located in the Geist class.
Looking for help if possible please...
By Jamyjambo, with 6 replies.
Last reply by danpost, over 6 years ago:
<Code Omitted>would check top center of the collector. You may want to also check the height of the trash above ground -- make sure it is within a specific range (minimum range would be fall speed of trash) before collecting it (before the catch is executed).
AUTUM PROJEXT - Greenfoot book scenario
By dROS, with 3 replies.
Last reply by Super_Hippo, over 6 years ago:
Any reason why it has to be checked in the Block class code instead of the Leaf class code? In the Leaf class, it can simply be: <Code Omitted> To do what danpost said, it will look like this: <Code Omitted>
Spawning an actor on the right side of the world
By MLGwarfare, with 8 replies.
Last reply by danpost, over 6 years ago:
MLGwarfare wrote...
I keep getting an error for the getWorld (showed in code) and I do not know how to make it work. do you know how I would be able to change the code to make it compile correctly?
The
getWorld
method is an
Actor
class method. You cannot execute it on a
World
object. Anyway, the code from line 23 to line 28 appears to be something an
oil
object might want to do -- not the
World
object.
How do you create an array for spawning actors in a random order
By KylesGallery, with 9 replies.
Last reply by danpost, over 6 years ago:
You are still trying to execute the spawning code prior to the
ArraySelection
actor being put in the world. Make use of the
Actor
class method called
addedToWorld
.
Next Level
By HEISENBERG, with 2 replies.
Last reply by danpost, over 6 years ago:
First, there is no need for any of the
boolean
fields. In fact, as soon as you change levels, they all become
false
again, anyway. Second, you can add the door at the moment the coin counter reaches 5: <Code Omitted>Lastly, you can check the level when changing worlds:
Creating an instance Variable?
By jstofer2, with 2 replies.
Last reply by jstofer2, over 6 years ago:
Thank you!
Spawning character on key press & sound playing
By MLGwarfare, with 1 reply.
Replied to by albertlai431, over 6 years ago:
You'll have to put those if statements in the act method of the world, since the constructor is only called once when the world is declared. You'll want to be continuously checking if the space button is pressed, not only once.
Collection System
By HEISENBERG, with 4 replies.
Last reply by danpost, over 6 years ago:
HEISENBERG wrote...
No, I don't think so... I'm calling the collect method, and in there is the Actor
Please show entire class codes.
Trying to minimize lag on Greenfoot website?
By albertlai431, with 12 replies.
Last reply by danpost, over 6 years ago:
It would probably take a member of the greenfoot team to confirm, but I get the distinct feeling the answer is no. Before they went to javascript and having their own
Color
and
Font
classes, my
TextImage
support class would allow
GreenfootImage
objects to be created using a specified font. Unfortunately, it is now pretty much obsolete.
Greenfoot Bug??? (Again)
By ITStudent, with 3 replies.
Last reply by ITStudent, over 6 years ago:
Okay, so i had made a new static int PO and now its working fine. Maybe it was a bug from Greenfoot
Where can I get a copy of crab2.png?
By Hal_cat, with 1 reply.
Replied to by danpost, over 6 years ago:
Download the
book scenarios
. All crab scenarios in
chapter02-04
have it.
mirrorVertically problem
By Hundmat, with 1 reply.
Replied to by danpost, over 6 years ago:
The line: <Code Omitted>mirrors the current image. When executed again, it mirrors that mirrored image. Etc. You will either have to keep track of whether each image in each array is already mirrored or not OR keep and use the mirrored images in separate arrays.
Sound = playing a sound of a World, if no other Sound is playing
By ITStudent, with 4 replies.
Last reply by ITStudent, over 6 years ago:
Finally it works. Thank You I just typed public static final before GreenfootSound and now everything works fine. Chapter closed! :D
Adding increasing levels to game.
By AVH, with 3 replies.
Last reply by danpost, over 6 years ago:
AVH wrote...
Is there a better or easier way to add levels after the orcs are removed. I'm getting confused with the code.
??? Better or easier than what? I do not see any codes either checking for no orcs or for changing levels?
161
162
163
164
165
166
167
X