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
Health Bar isn't working
By annika.g, with 7 replies.
Last reply by annika.g, 5 days ago:
Thank you, its working! :)
Score counter
By BR01, with 1 reply.
Replied to by danpost, 6 days ago:
BR01 wrote...
I need help with score counter. GetScore doesn´t work at all.
Cannot help fix unknown codes. Show ALL codes in all classes relating to the counter in question.
enemy throwing objects to the left and right
By MsWoof, with 10 replies.
Last reply by MsWoof, 6 days ago:
Thanks! :) You made my day! It's working now, hooray!
drawLine() change color of some lines but not all?
By MaDrexan, with 2 replies.
Last reply by MaDrexan, 6 days ago:
@danpost omg thx
Everything stop after score is add. how do i fix it?
By dROS, with 1 reply.
Replied to by danpost, 6 days ago:
Move line 41 down a line or two. The
getWorld
call needs to be before that line since when the actor is removed from the world, it will have no world to get.
Keep Object in New World
By HEISENBERG, with 6 replies.
Last reply by danpost, 6 days ago:
HEISENBERG wrote...
Well for some reason my player gets stuck at level 2 as the counter gets reset every time
Use the current level to determine what level to proceed to. Something like the following to replace all player codes above:
How to remove object after it reach edge and remove object if it hit another object?
By dROS, with 2 replies.
Last reply by dROS, 6 days ago:
Thank you so much for your help
How do I access an object from another class?
By NB111, with 3 replies.
Last reply by danpost, 7 days ago:
Nosson1459 wrote...
Also just by way of suggestion you can cut your code by at least half if you use an Array, and For loops to place them in the world. like this: <Code Omitted>to instantiate them use a For loop like this: << Code Omitted >> to add them in to the world use this loop << Code Omitted >>
The quoted line of code should be: <Code Omitted>and I would have done the rest with:
Need help with making an inventory with Singleton pattern and ArrayList
By XardasTheSilent, with 11 replies.
Last reply by XardasTheSilent, 8 days ago:
Thank you for the example. I modified my inventory a little and know I have this:
java.lang.NullPointerException NEED HELP!
By Vitalizera, with 3 replies.
Last reply by danpost, 8 days ago:
Remove the first word from line 21. You do not want to declare a new variable there. You want to refer to the field declared on line 3.
Showing Text in a Game
By Haylaylo11, with 6 replies.
Last reply by Haylaylo11, 8 days ago:
Nevermind, I just figured it out. I feel really dumb, but thanks for your help!
Grabbing Weapons In A Top Down Shooter
By W_JL, with 1 reply.
Replied to by danpost, 8 days ago:
W_JL wrote...
I want to make the weapon dissapear after I grab (or should i say touched) it and make it appear on my character. I used if touching and then transparancy to 0 but with that code I can't make the weapon follow my character around because if I touched it. It will dissapear.
True that you cannot have it both disappear and appear at the same time. So ... why make it disappear at all?
Scrolling world with mouse
By mattnorth, with 1 reply.
Replied to by danpost, 8 days ago:
mattnorth wrote...
I am making a game similar to Agar.io and I am having issues with my actor following the mouse in the scrolling world. Anyone know how do scroll using the mouse?
Program the actor to follow the mouse without regards to the scrolling. Then, scroll the world depending on the actor's position.
Transfering Variables from Actor to World
By PhoenyxProgramming, with 2 replies.
Last reply by danpost, 9 days ago:
PhoenyxProgramming wrote...
I'm now trying to make the chance of Food Spawning randomly, which I have coded in the MyWorld class, dependant on the 'Score' variable from the Ant class (or set global Variables in the World class which can be changed by Actor classes). << Code Omitted >>
An easy way is just to keep a reference to the
AntPlayer
object in your
MyWorld
world:
Exporting standalone to Raspberry pi (Raspbian)
By Higgins1904, with no replies.
Hi, I have done a simple Greenfoot project at my Win 10 computer, runs fine in the Greenfoot GUI version 3.6.0. Now I want to export it and run it at my Raspberry pi 4 (Raspbian) that has the Java version 11.0.5. I read at the export info page here that one need to tinker with the command line arguments when executing the exported jar-file. Anyone that knows what needs to be done? I try to run it with the following command line: java -jar /home/pi/test.jar I get an error message saying that the class greenfoot.export.GreenfootScenarioApplication is missing or could not be loaded. The file is there in the jar file, at the path greenfoot.export, I can see that when inspecting the contents of the package. Both my Pi and my Win 10 computer runs Java 11
1
2
3
4
5
6
X