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
How can i spawn a actor like a bullet spawn on another actor
By Thijn, with 1 reply.
Replied to by danpost, about 1 month ago:
Thijn wrote...
I tried spawning a bullet in a spaceship everytime you press space but it did not work i dont know how to spawn a bullet on a moving spaceship so maybe you guys can help me out
In the class of the spaceship, use something like the following: <Code Omitted>You may also need the following: <Code Omitted>
Draw Polygons on Image Background
By UmbranDrake, with 4 replies.
Last reply by UmbranDrake, about 2 months ago:
Thank you!!
Restarting a bg song
By Alberthepirate, with 1 reply.
Replied to by danpost, about 2 months ago:
Alberthepirate wrote...
So I have so far GreenfootSound song = new GreenfootSound("song1.mp3"); But, is there a way so I can restart the song?
<Code Omitted>as opposed to: <Code Omitted>which just resumes the song.
how to make the playbutton work with a smal script
By gijsee, with 1 reply.
Replied to by gijsee, about 2 months ago:
i did it
.get counter is not working for my shooter game
By Pls_help, with 3 replies.
Last reply by Pls_help, about 2 months ago:
Never Mind my problem was solved Thanks
Shooting
By Kookaburra737, with 4 replies.
Last reply by danpost, 2 months ago:
Kookaburra737 wrote...
Thank you so much, it works perfectly now, but how would I delete the bullets touching the worlds border?
Use code like the following in the
act
method of the projectile's class: <Code Omitted>You can modify the code to include vertical limits.
Why can't Greenfoot 3.8.2 export jar files?
By sandhsf, with 1 reply.
Replied to by nccb, 2 months ago:
Here's the reasoning, but I'd be happy to listen to everyone's intended use for it to see what everyone wants from this feature. Running a Greenfoot scenario requires a working Java installation and all the JavaFX libraries, and the Greenfoot common classes and the scenario bits. We can bundle the latter two into a JAR, which is what we always used to do. The Java installation is not impossible if you ask your intended user to install it, as it will go on your PATH so Greenfoot doesn't need to know where it is. The problem is the JavaFX installation. We cannot easily bundle this in the
publishing in greenfoot
By karthigakumar, with 1 reply.
Replied to by nccb, 2 months ago:
What version of Greenfoot are you using?
Damage Enemy (Edit variables in enemy class from hero class)
By Sloppybobby3, with 1 reply.
Replied to by danpost, 2 months ago:
Sloppybobby3 wrote...
I'm trying to make my player do damage to an enemy, but I cannot seem to figure out how to edit variables across classes. It compiles with no syntax errors, but does not appear to make any changes to the variable. << Codes Omitted >>
Try something like this in the Player class: <Code Omitted>
Getting white screen and no console errors.
By jlau, with 1 reply.
Replied to by nccb, 2 months ago:
From poking it with the Javascript debugger, it seems that the world is actually loading up, but something is going wrong. It seems that the world remains GameWorld after initialisation. I suspect the problem may be that in the constructor of GameWorld, you call Greenfoot.setWorld() to change the world. But Greenfoot's default behaviour after constructing GameWorld is to call setWorld() with the just-constructed GameWorld, which happens after you have called it, so your change of world is ignored. As it happens, the Greenfoot desktop version has some code to guard against exactly this scen
Publishing
By karthigakumar, with 3 replies.
Last reply by danpost, 2 months ago:
karthigakumar wrote...
But I was found an error. Unknown host. How to solve it?
It could just be something temporary. Try it again. If the hosting error continues, see if a greenfoot team member can help you.
No suitable Java JDKs were found
By zonks, with 2 replies.
Last reply by zonks, 2 months ago:
That solved it! Thanks so much for your help. Navigating to the jdk folder in the Greenfoot directory worked.
UML from Greenfoot code?
By kaese340, with 1 reply.
Replied to by nccb, 2 months ago:
This
Stack Overflow page
has some suggestions for tools to do this. If you just want something basic then you can use our BlueJ tool to show a diagram. Make a new BlueJ project somewhere, close BlueJ then copy in all your Greenfoot classes and load BlueJ again. They won't compile because it won't find the Greenfoot classes, but it should at least show all the links between the classes in terms of inheritance and which class uses which.
Getting Exception instantiating world class:java.lang.IllegalArgumentException
By jlau, with 2 replies.
Last reply by danpost, 2 months ago:
jlau wrote...
Hi, I am getting Exception instantiating world class:java.lang.IllegalArgumentException - null on my scenario << Link Omitted >> Please help as I am not sure why
I believe the problem is that you left all the
System.out.println(...)
statements in your code when you uploaded it. Try removing them first (or comment those lines out of the code).
Points System
By Kookaburra737, with 1 reply.
Replied to by danpost, 3 months ago:
Kookaburra737 wrote...
I can't figure out how to Display the Heat/score, I read the notes in the displaying values tutorial but I'm having trouble understanding the concept.
There are only two ways to display anything in your world using greenfoot. One is changing the background image of the
World
itself (not recommended) and the other is by using the image of an
Actor
type object. The
Actor
object will need to be retained in an
Object
reference variable -- in a field, for example: <Code Omitted>Have it added into the world when
1
2
3
4
5
6
X