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 Do I make Camera movement only go Horizontal and vertical at a certain height?
By Fire, with 32 replies.
Last reply by danpost, almost 2 years ago:
Fire wrote...
There is an error with check escape how do I fix that?
Remove the line: <Code Omitted>
Can you help me?
By BigBoy, with 1 reply.
Replied to by Super_Hippo, almost 2 years ago:
Check the API here and look through the available functions. You can probably find what you need :)
https://www.greenfoot.org/files/javadoc/greenfoot/Actor.html
Can you help me?
By BigBoy, with 1 reply.
Replied to by Super_Hippo, almost 2 years ago:
Could be like this if you world class is called MyWorld: <Code Omitted>
Pathfinding
By N8TH1N6, with no replies.
Hey, I wanna make my enemy find the best path to the player Class and also recognize the borders Borders work like this <Code Omitted>The movement of the enemy is just simply move(int) and when he connects with a border he turns and again moves in another direction. I want just a simple pathfinfing so the enemy follows the player around the borders etc.
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, almost 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, almost 2 years ago:
Oh! Thank you it works :)
falling object
By Rainescap, with 1 reply.
Replied to by danpost, almost 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, almost 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, almost 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, almost 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, almost 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, almost 2 years ago:
Change line <Code Omitted> to <Code Omitted>
24
25
26
27
28
29
30
X