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
Game Over Screen :(
By kingCaspian, with 12 replies.
Last reply by kingCaspian, over 5 years ago:
It worked! Thank you for the help.
Random asteroids with player atraction pls!
By DvAndrei18, with 1 reply.
Replied to by danpost, over 5 years ago:
DvAndrei18 wrote...
I make a space game and I need to have random asteroids spawning on margins and all of them fly randomly.
Length of margin is twice the sum of width plus height minus four. A random pick from length will give a single point along the margin. Converting the random value to a set of coordinates is do-able, but not a simple matter (just takes a little math knowledge).
Make everytime game starts random car start
By DatPaul, with 2 replies.
Last reply by danpost, over 5 years ago:
Or: <Code Omitted> or something along this line: <Code Omitted> The best way would depend on how you create your red and blue cars. That is why it always helps to provide related class codes (and describe your classes structure)
Resize a array
By Belinus, with 3 replies.
Last reply by danpost, over 5 years ago:
Belinus wrote...
Sorry, How? Could you do an example?
(A) Creating a new array: <Code Omitted> {B} Using an
ArrayList
object: <Code Omitted>The list can be of any
Object
type (pr
How do you describe the length of a wait?
By ChafikAZ, with 1 reply.
Replied to by danpost, over 5 years ago:
ChafikAZ wrote...
wait(As in,
what do you put here
)
Use <Code Omitted>(at normal speed, this would be about one second's time).
Getting variable frm another class
By Roshan123, with 15 replies.
Last reply by danpost, over 5 years ago:
Roshan123 wrote...
else setImage(new GreenfootImage (null...rest...);
Try: else setImage(new GreenfootImage(
""
...rest...); Or better yet: else setImage((Greenfootimage)null);
How to let a actor spawn a other actor at the same place?
By GreenfootUser1234, with 4 replies.
Last reply by RcCookie, over 5 years ago:
Btw you can remove line 3 as it does nothing
Thread.sleep() causing problems
By FirewolfTheBrave, with 2 replies.
Last reply by FirewolfTheBrave, over 5 years ago:
Thank you so much!
Image scale issue
By SwaggyXiao, with 4 replies.
Last reply by SwaggyXiao, over 5 years ago:
OMG MR COHEN!!!! YES! I FIND THAT ONE POTENTIAL REASON MY PROGRAM CRASH IS BECAUSE I DO SCALING 10000 TIMES ON THE CONSTRUCTER. PNG SCALING DOES NOT WORK WELL ON PREVIEW LOL SO PROBABLY I NEED TO FIND ANOTHER TOOL! OMG WHY YOU ARE ON GREENFOOT WEBSITE ALL THE TIME HAHAHAHAHAH!
Spelletje programmeren hulp gezocht
By Ilaria, with 6 replies.
Last reply by Ilaria, over 5 years ago:
Oke, thank you. @Danpost
remove bullet when reaching edge - MVC
By Milka, with 3 replies.
Last reply by danpost, over 5 years ago:
In
KogelView
class
update
method, you would need to check with: <Code Omitted>and then remove the
KogelView
object from its controller to effectively remove the bullet it controls.
Loading external images
By Commentator, with 3 replies.
Last reply by MrCohen, over 5 years ago:
Sorry I hastily chopped two parts together. Thanks for the correction. I'm curious if this will solve OP's problem
Compressing size of scenario
By Roshan123, with 2 replies.
Last reply by danpost, over 5 years ago:
Roshan123 wrote...
Will it work my re- scalling an Image???
Best to scale images with an image app like
Paint
. Image manipulation during program execution can increase the possibility of lag (or increase the present lag). Reducing the entire size of your scenario would probably help as far as lag is concerned Think of it -- cutting all length in half would reduce image file sizes to one fourth (1/2 by 1/2). Removing image files not required for the scenario would help load time.
Heads or Tails game
By Tycr, with 9 replies.
Last reply by danpost, over 5 years ago:
Tycr wrote...
https://www.greenfoot.org/scenarios/27252
You need to upload it again (update it) -- this time, just make sure to check the "
Publish source code
" box.
Text/char input
By Commentator, with 3 replies.
Last reply by danpost, over 5 years ago:
Might want to also restrict the key returned to being character values of at least 32 (to printable characters). Line 10 in Hippo's code could be: <Code Omitted>
93
94
95
96
97
98
99
X