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 to set a score that keeps the same in new worlds?
By LR6549, with 2 replies.
Last reply by danpost, over 3 years ago:
LR6549 wrote...
I tried to make a game where the world (Level) changes depending on the amount of items collected. But every time a new world is generated, the amount of items gets set to 0. To fix this I tried to call the class with the amount of items (public Player(int items){}) but this completly removes the act funktion even though you use the run option. how can I fix it?
Try putting the same
Player
object in the new world. That is, for example, something like this:
How to get Variables of other Actors?
By LR6549, with 3 replies.
Last reply by danpost, over 3 years ago:
LR6549 wrote...
<Code Omitted>
The
Score
object is not a
Player
object. That is, by having
Score
extend
Player
, you are saying that any
Score
object will be a player. It will have all the attributes of a player and all the behavior of one before being appended/modified by the code in the
Score
class. Score should extend some class that is a more general object than a Score object. This could be something like GUI or Component or, simply, Actor -- which is most probably the best in your case. Also, you are cre
"Publish failed: The Scenario is too large"
By Jestry, with 1 reply.
Replied to by danpost, over 3 years ago:
Jestry wrote...
I don't know, thought it was a good idea to build a "real" game in this engine XD. Now it's too large, can i do anything against that, rather than simply deleting code?
The usual cause is due to sound file sizes. Try to reduce or eliminate large sound files, first.
Accessing an actor's boolean in the world
By Iactuallyhavegreenfeet, with 1 reply.
Replied to by Spock47, over 3 years ago:
Change line <Code Omitted> to <Code Omitted>
My Code my wont Compile
By ZagreusCat, with 1 reply.
Replied to by Super_Hippo, over 3 years ago:
For a start, put line 4 in a { } block and put line 6 into the same block without the condition.
Wie kann ich ein boolean wert von einer anderen classe in eine if schleife zur anderen klasse machen?
By d1cM4c, with 13 replies.
Last reply by Spock47, over 3 years ago:
Ganz genau. Am besten einfach ans Ende der Methode ein (unbedingtes) "return false;" setzen so wie es im Eröffnungspost war: <Code Omitted>
Can somebody please send me the solutions to the turtle recursion?
By lecaycay, with no replies.
Hello, I need to programm a code, where a turtle creates object. For that i should use the recursion and now I am asking If anybody has the code on the creation of a snowflake and/or koch curve? Thanks in advance.
How to make my character not disappear when using static variables
By Quinnterruption, with 5 replies.
Last reply by danpost, over 3 years ago:
Quinnterruption wrote...
I dont want the character to move thats why have i that line tthere.
The actor focused on (the one that stays center-screen) is an actor that moves in your world. The code in your world class (that which controls the scrolling) tells the
Scroller
object to scroll with amounts based upon that actors movements in the world, or by how far it has moved from the center. The scrolling will put the actor back in the center and the actor will not appear to actually move, though moving in the scrolling world.
I read the scrolling tutorial and messed wit
how can I pick up items and throw them away in the game
By alex45254, with 4 replies.
Last reply by danpost, over 3 years ago:
alex45254 wrote...
is it be like that? public void pickup() { if (isTouching(duck.class)) { Actor actor = getOneIntersectingObject(duck.class); } }
Well, the actor would not want to pick one up if it was already holding one. So: <Code Omitted>
how to place a object down in order as it reads a text file
By Ilovemarcus, with 2 replies.
Last reply by Spock47, over 3 years ago:
After danpost already did all the hard work and presented a good solution, I just want to add one small detail: Since JDK7, you can use a String value directly with switch, e.g. <Code Omitted>
How to reference non-static getRotation() in static Context.
By Riovanni, with 2 replies.
Last reply by Riovanni, over 3 years ago:
oh okay. thanks
How can an actor stop his own act()?
By leuveg, with 1 reply.
Replied to by danpost, over 3 years ago:
leuveg wrote...
I tryed
Greenfoot.stop()
in fahre() but not work. And now?
The code in the
else
part starting at line 13 will only execute if BOTH the
bodenVorhanden
AND the
Ziel
objects are touching this
Auto
object. That means that the
bodenVorhanden
and
Ziel
objects must overlap (intersect each other). Is that the way you have it?
Converting Greenfoot software to Steam
By Jestry, with no replies.
Is it possible to emulate Greenfoot games on steam? Or, because the purpose of this Engine is mainly an educational one, there still wasn't attempted to do so?
Do space games using addforce add too much when combining thrusters?
By robertjulia, with 2 replies.
Last reply by Crickblack124, over 3 years ago:
robertjulia wrote...
I'm playing a few space games that I do actually have the unity project for, since they were either publicly available or given to me. I have looked in the scripts for acceleration and the games just use unity's mechanism to add force to rigid-bodies. basically, they both feature 6axis manual thrust, so that all inputs are certainly from me. First, correct me if I'm wrong, but if you use two thrusters that are 90 degrees out in angle, then the resulting vector should be the result of the Pythagorean theorem yes? So, you add force from one thruster, a , then from another t
Why my game is not working
By Greenfoot2022, with no replies.
Why my game is not working when I upload it in website. It is giving me error
31
32
33
34
35
36
37
X