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
timer
By beyondFrustrated, with 1 reply.
Replied to by Super_Hippo, almost 10 years ago:
The easiest way would probably be this: <Code Omitted>
Why is this spawning before it equals the number?
By t_k_990, with 3 replies.
Last reply by t_k_990, almost 10 years ago:
Oops, that was the wrong script. I posted the right one
here!
textbox input
By roinitalucian, with 3 replies.
Last reply by danpost, almost 10 years ago:
You probably need to create a subclass of Actor for the object; create the base image in the constructor; add a field for the text; create a method that create an image of the text, draws it on the base image and sets it to the actor; add a boolean field to represent focus state; add code to the act method to check for focus, and if focused, check keyboard input and adjust the text and update the image as needed.
Random number generator problems
By PeterL, with 7 replies.
Last reply by danpost, almost 10 years ago:
PeterL wrote...
I was told this was how to update an image.
I wonder who told you that (unreliable source?). There is no 'updateImage' method in the Greenfoot class at all.
awt event queue error
By xinzhaogg, with 1 reply.
Replied to by danpost, almost 10 years ago:
xinzhaogg wrote...
this weird error appeared. Apparently, I am missing a reference pointer and the result prevents me from compiling/ running the game.
Please show the complete error output you got.
is greenfoot really programming?
By MasterProgrammer, with 1 reply.
Replied to by Super_Hippo, almost 10 years ago:
Yes, it is. Why not?
my game
By jacquelinereilly, with 7 replies.
Last reply by jacquelinereilly, almost 10 years ago:
thank you!! easier than I thought, thanks so much
characters
By jacquelinereilly, with 1 reply.
Replied to by Super_Hippo, almost 10 years ago:
With a gif image, there is a method which automatically gets the next image. You can obviously do everything which a gif image can with "normal" images and some code, too.
Check Boundaries heelp
By Hondrok, with 1 reply.
Replied to by Super_Hippo, almost 10 years ago:
Add an int variable which you can use as a timer. Set it to some number whenever a shot is fired. Each act cycle, you decrease that number if it above 0 and only if it is 0, you can shoot. (Obviously you can also increase it and do it the other way around.)
need help with nullpointerexceptions
By brothermic, with 3 replies.
Last reply by Super_Hippo, almost 10 years ago:
The constructor is executed when the object is created, before it is added to the world. That's why your 'world' variable is never anything else then 'null'. If you really want to save a reference to the world in your enemy class, you can add the 'addedToWorld' method: <Code Omitted> Maybe you can also use this (try it out, I am not sure): <Code Omitted>
Request info on sprites: height, width, and file path
By earnold, with 1 reply.
Replied to by danpost, almost 10 years ago:
earnold wrote...
Just curious what the original sprite height and width dimensions are, and where those files are stored. Thanks!
You can find the images in the 'Greenfoot/lib/greenfoot/imagelib' folder.
`java.lang.NullPointerException` error
By dandrei279, with 8 replies.
Last reply by dandrei279, almost 10 years ago:
I fixed it! I moved the 'Space a=(Space) getWorld();' line in act() when the user presses `SPACE`. Now everything works fine! Thanks Super_Hippo! Thanks danpost!
Setting Images
By Hondrok, with 2 replies.
Last reply by Hondrok, almost 10 years ago:
Super_Hippo wrote...
You need to get a reference to it and then you can call the 'setImage' method on it.
Thank youu
Invalid Moves.
By KennethTheSuperMelon, with 2 replies.
Last reply by Super_Hippo, almost 10 years ago:
When you get the target location, compare the x and y to the size of your world, so if it is negative or 8 or higher, instead of moving, you print out a message (or create an object which uses an image with the message).
Text Alignment on New Line
By Theangryman, with 1 reply.
Replied to by Super_Hippo, almost 10 years ago:
I don't know if there is a more easier way, but I would probably create a new image for each line and then draw all these images below each other on one image which the object can use.
407
408
409
410
411
412
413
X