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
Transfering Variables from Actor to World
By PhoenyxProgramming, with 2 replies.
Last reply by danpost, almost 7 years 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
Exercise 9.70 add asteroids using generic type list<>
By dROS, with 2 replies.
Last reply by dROS, almost 7 years ago:
Thank you so much for your help. you are awesome
Greenfoot.mouseClicked doesn't seem to be working
By NB111, with 2 replies.
Last reply by NB111, almost 7 years ago:
Super_Hippo wrote...
1. The act method should not have any arguments. 2. The mouseClicked method requires an Actor object. Not a list. <Code Omitted>
Thanks
Setting Images
By TylerBlair, with 3 replies.
Last reply by danpost, almost 7 years ago:
TylerBlair wrote...
How should I change it so the image displays on top of the black background?
To display it "on top", you would use an actor. To display it "on", draw the
directions
image onto the background of the world.
Pause Code of one Object
By insurqassable, with 1 reply.
Replied to by danpost, almost 7 years ago:
insurqassable wrote...
<< Code Omitted >> I want to have a little bit of time between the image of the lock getting changed and the lock getting deleted, so you can actually see the opened Lock.
Add an
int
timer field to the
KeyLock
class. Set it to some positive value (30-60 maybe) when opened. Use
act
to count down the timer and upon reaching zero, remove the actor.
Hey, How do i use generic class type List<>
By dROS, with 1 reply.
Replied to by danpost, almost 7 years ago:
dROS wrote...
How do i use generic class type List<> to calculate how many asteroids are left in the world background and add new asteroids when all have been cleared away. new ones appear, one more every time.
Just use: <Code Omitted>in an
act
method in your
Space
class.
Add certain amount of objects
By SemDeBakkero, with 10 replies.
Last reply by SemDeBakkero, almost 7 years ago:
Oh shit thanks!!
Getting the location of an object
By ihjufaeshiju, with 3 replies.
Last reply by danpost, almost 7 years ago:
ihjufaeshiju wrote...
Can you explain what line 5 does though?
LIne 5: <Code Omitted>defines a variable that can reference an
Actor
object and assigns to it an object, from the
houses
List
object at index
i
, cast as an
Actor
object (
(Actor)
).
Download a new font
By Ti103, with no replies.
Hi, i'm new here. I have a project and i have to use a downloaded font. When I use anyfont, it works very well, but when I use the downloaded font, it doesn't work.<Code Omitted>
fff
By DARKSGAMER, with 1 reply.
Replied to by AndyGun, almost 7 years ago:
?
Greenfoot exercise 9.69
By dROS, with 1 reply.
Replied to by danpost, almost 7 years ago:
dROS wrote...
Can anybody check my code? Code is between 77 to 89.
The condition on line 81 will always be true (that is, unless size is less than or equal to zero -- which would be never). I think you should be asking if the size is greater than 16 or not.
Exercise 9.69 Fix the score count
By dROS, with 3 replies.
Last reply by danpost, almost 7 years ago:
dROS wrote...
code for more classes can you check it. << Code Omitted >>
Appears okay. And, finally, your
Bullet
class? It would seem like that is where the collisions are detected.
How can i have a player to move a certain amount of steps in order to finish the game?
By KiddoNow, with 1 reply.
Replied to by danpost, almost 7 years ago:
KiddoNow wrote...
I have a player and they can move 1 step by pressing an arrowkey. Now i want them to reach an object and collecting it BUT with a certain amount of given steps. Lets say you start in the bottom left corner and the other object is somewhere in the upper right corner. Now you have to reach that object with exactly 15 steps e.g. How can i make such a counter?!
Just add an int field for the player. Increment it each time it moves. When object is reached, check its value for win/lose.
How to get the code for the Greenfoot base classes
By SailingStone, with 2 replies.
Last reply by SailingStone, almost 7 years ago:
Thanks for that! That helps a lot.
160
161
162
163
164
165
166
X