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
Modify constructor code
By octav20071, with 2 replies.
Last reply by octav20071, over 4 years ago:
danpost wrote...
octav20071 wrote...
I want to modify Greenfoot's constructor code, for MyWorld and actors, but where is the script located? I know what I'm doing, I only want to know what is the path to the text file.
If you want to modify the templates for when the classes are created, you can use any text editor finding the files at: greenfoot/lib/english/greenfoot/templates
alright, thank you very much!!
How can I add background music while the game is running?
By Pabloseb_, with 1 reply.
Replied to by Roshan123, over 4 years ago:
<Code Omitted>
can some correct this error plz
By divinity, with 5 replies.
Last reply by danpost, over 4 years ago:
danpost wrote...
no valid values have been assigned those variables prior to the constructor calls.
Assign values to them prior to calling the constructors.
Why the iframe of my game not work?
By 23571113, with 2 replies.
Last reply by 23571113, over 4 years ago:
Thanks! It woks pretty well now.
Animation with Image Arrays overriding each other
By BaseEvoli, with 2 replies.
Last reply by danpost, over 4 years ago:
It is not easy to give advice here. On one hand, there is lag due to reading in multiple images during game time. On the other hand, there is a lot of memory used up if the images are loaded up front. However, that is what I think you should do -- load all the images into arrays when you create the character. With these field arrays, you can add one more field array for the one that is currently being used (by setting it equal to one of the others). Use only one timer for the current animation (along with the shot delay timer). You will also not need fields for frame counts (size of arra
Pop-up message
By StndRed, with 7 replies.
Last reply by Super_Hippo, over 4 years ago:
You can use the Color class provided by Greenfoot. It is very similar to java.awt.Color. You have to create an image, set the color and then use the drawString method to draw text with the given text color to the background. However, if the text on the image is everything you need, it might be enough to use another constructor for the GreenfootImage class. You can set the text color (‘forgreound’) directly. Check the API here:
https://www.greenfoot.org/files/javadoc/greenfoot/GreenfootImage.html
identifier expected
By divinity, with 3 replies.
Last reply by danpost, over 4 years ago:
Use "<AbstractButton>" in line 1 (instead of what you put).
Java Exception for my code in Greenfoot
By Freddy05, with 9 replies.
Last reply by RcCookie, over 4 years ago:
I don’t know - java has ways to invoke JavaScript commands. But as far as I know that also doesn’t work online. But if someone can get that to work that would open a whole new set of options.
How to prevent objects from pushing each other?
By BaseEvoli, with 1 reply.
Replied to by danpost, over 4 years ago:
BaseEvoli wrote...
Here is the project,
Upload project here providing source codes.
More Colored Code Quiestions
By Gabe1098, with 4 replies.
Last reply by danpost, over 4 years ago:
Gabe1098 wrote...
what about "short, long, byte, float, char"
They are all different primary types. See
this
page of the java tutorials.
How to properly animate my character?
By BaseEvoli, with 7 replies.
Last reply by danpost, over 4 years ago:
You may want to check out my
Animation
support class (either for reference or for usage). You can find it
here
.
giving X, Y, and Rotation & calling a method from an actor to myWorld
By Gabe1098, with 10 replies.
Last reply by Gabe1098, over 4 years ago:
danpost wrote...
Gabe1098 wrote...
I have a new error... it says "method createBullet in class MyWorld cannot be applied to given types: required no arguments: found: int, int, int reason: actual and formal arguments lists differ in length"
Add parameters to the method (line 24) to suit your arguments (those values you are trying to pass to the method).
Ooohhh lol I feel so dumb xD Thanks!
Based on Blue j and greenfoot
By Roshan123, with 3 replies.
Last reply by RcCookie, over 4 years ago:
No, you can’t do that. The only thing you could do is also share the Greenfoot installation
How can I spawn a Object on another Object
By Prummi, with 1 reply.
Replied to by danpost, over 4 years ago:
Prummi wrote...
How can I spawn ... Object at the same position where my actor is?
<Code Omitted>
where is the boolean?
By divinity, with 4 replies.
Last reply by danpost, over 4 years ago:
divinityI wrote...
: am still getting this error here with this line of code: totalpay = ((hoursWorked >= 40) && (hoursWorked <= 1.5)); do I remove or how to fix it
danpost wrote...
Remove lines 8 and 17. Then change line 51 to: <Code Omitted> Line 59 needs parentheses around "getHours() - 40".
62
63
64
65
66
67
68
X