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
Objekte runterfallen lassen
By AlexMue, with no replies.
ich habe diesen Code benutzt um Objekte von oben nach unten fallen zu lassen jetzt möchte ich Einfügen eines nach jede 5 Sekunden welche von oben nach unten fahren lassen // Objekt fallen lassen setLocation(getX(), getY() + 1); // Bodenkollision if (getY() == getWorld().getHeight() - 1) { getWorld().removeObject(this); } for (int zaehler = 0; zaehler < 10 ; zaehler++) { Banane banane = new Banane(); addObject(banane, Greenfoot.getRandomNumber(1080), Greenfoot.getRandomNumber(1)); } die beiden codes habe ich benutzt um Objekte von oben nach unten runter fallen zu lassen
Adding gun to a player
By 84mu3lC3p4C7, with 5 replies.
Last reply by 84mu3lC3p4C7, about 2 years ago:
I wasn´t able to post messages, sorry I wasn´t responding. I got little bit closer to what I want by looking at this:
How to rotate an object orbiting another object without making the object rotate
, so thank you danpost.
Add text to txt instead of overwriting (FileWriter)
By tylermwise, with 2 replies.
Last reply by tylermwise, about 2 years ago:
Oh! Thank you it works :)
falling object
By Rainescap, with 1 reply.
Replied to by danpost, about 2 years ago:
Rainescap wrote...
How do i make a falling object and make it so that it spawns in different spots in the x axis
The following line in the
act
method of the class (
Actor
subclass) will make the instances of that class "fall": <Code Omitted>The literal '1' can be adjusted up to increase the speed. The
MyWorld
class
act
method should be used to spawn the falling objects, using the following for the x-coordinate of placement: <Code Omitted>
Sound issue
By N8TH1N6, with no replies.
Hey, I dont know if I am the only one with that problem but somehow sometimes music is played normally with the following code<Code Omitted>//<Code Omitted> // Sometimes there is no Issue and sometimes it just doesnt play.
Not able to use networking in greenfoot scenarios website.
By archil, with no replies.
I am using UDP for sending data packages but when I am hosting the game on Greenfoot scenarios, the networking part doesn't work, but it works perfectly fine when I run the jar file locally. can someone please tell me what the problem could be?
some help
By Carlos9173773838271, with 3 replies.
Last reply by danpost, about 2 years ago:
Carlos9173773838271 wrote...
the image changes very fast, Isn't there some code to make it wait a certain amount of time?
You need to set
timeDurationToNextImage
to some value like 8 so at line 8.
How to set a score that keeps the same in new worlds?
By LR6549, with 2 replies.
Last reply by danpost, about 2 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, about 2 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, about 2 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, about 2 years ago:
Change line <Code Omitted> to <Code Omitted>
My Code my wont Compile
By ZagreusCat, with 1 reply.
Replied to by Super_Hippo, about 2 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, about 2 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, about 2 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
26
27
28
29
30
31
32
X