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
Spawning Actor not Working
By Total-Eclipse, with 5 replies.
Last reply by danpost, about 5 years ago:
Total-Eclipse wrote...
I found out that when I set getObjects(Key.class).size(); as a varaible named Keys_in_World, and then inspect the world even though there are 2 KEys visible it shows 0.<Image Omitted>
Show class codes for this.
Why doesn't this code write on the background on the screen?
By AnJoMorto, with 5 replies.
Last reply by AnJoMorto, about 5 years ago:
Found a solution, turns out I'm just dumb:
AddedToWorld() method
By Roshan123, with 3 replies.
Last reply by danpost, about 5 years ago:
Roshan123 wrote...
can i call it a bug in greenfoot or lack of knowledge by me
It's not a bug in greenfoot. It is provided as an empty method by greenfoot (just like the
act
method). Both are called internally by greenfoot (at appropriate times). Both are available to be over-ridden to add some implementation to them (have them actually do something).
My scenario is not working when I upload it to greenfoot.
By Ned, with 6 replies.
Last reply by Ned, about 5 years ago:
Thanks again!
Can't spawn new Actors of a class after I removed them
By hernry2812, with 7 replies.
Last reply by hernry2812, about 5 years ago:
Thank you very much, it works now ;)
How to get an actor to move up to a certain point in the word
By oofitsme, with 3 replies.
Last reply by danpost, about 5 years ago:
A class name is not an
Actor
object (instance of
Actor
), which is required by
removeObject
. Use: <Code Omitted>
Scoreboard for time based game
By AnJoMorto, with 3 replies.
Last reply by AnJoMorto, about 5 years ago:
Sorry for such a late response. I didn't have the time to come back to programming this last days. Thank you, @danpost, for your answer. I'll try to figure a way out to achieve it with the information you gave me. Thank you and all the best
Set Background of World in Actor which is not in this World
By TechNick, with 1 reply.
Replied to by danpost, about 5 years ago:
TechNick wrote...
I have a world with settings for my game. In this world you should be able to click on a button and change the background of the world where the main game is. But I don“t know how to change the Background of the gameworld when the Actor is not in this world.
Store the
String
filename of the background image in a field in your settings world. When creating the game world, set its image right there before setting the game world active.
Wombat movement with left or right arrow
By Mutex, with 8 replies.
Last reply by Mutex, about 5 years ago:
Thanks
How could the World actually work?
By KlausKrieger, with 3 replies.
Last reply by RcCookie, about 5 years ago:
No problem:-) Concerning the change of the world, this might also help: Every frame of the Greenfoot application the current world gets rendered by (simplified) stacking the images of all the actors on top of the worlds background image. If the world changes, the images used to render will simply look different on the next frame, which results in the world being switched visually. Additionally, Simulation will call act on the new world.
Animation/Direction problem
By Genota, with 3 replies.
Last reply by danpost, about 5 years ago:
Genota wrote...
Okay, but now he is just moving infinit to the right and not turning after the counter to the left like before.
Multiply
speed
by
direction
in line 24.
Object should rotate withouth the image
By gfsdhjjks, with 6 replies.
Last reply by danpost, about 5 years ago:
gfsdhjjks wrote...
somehow my ghost wont rotate anymore at the given points... Eventhough I used getImage().rotate instead of set Rotation.
Do NOT rotate the image. Maybe I misunderstood what you were trying to do. Please explain, in detail, what behavior you are trying to achieve.
calling a method
By Jemy, with 3 replies.
Last reply by danpost, about 5 years ago:
Jemy wrote...
Please can you show me what you mean?
As an example: <Code Omitted>Note the line 2 calls the
Actor
class method,
setImage(String)
, on an
Actor
type object,
actor
.
Possible Account Deletion
By Alola_Sandslash, with no replies.
I would like for this account to be deleted. Hopefully a moderator could do this for me. Otherwise I am simply abandoning the account.
For loops not working
By BeeSauce, with 1 reply.
Replied to by RcCookie, about 5 years ago:
I assume "Wait" is initially 0. And 25ms is not a quarter of a second but a fourteeth. You should use 250 there. But that is not the main problem. The thing is the first for-loop can run really quickly, and only if it is very slow (taking the 25ms) it would spawn another instance. The much simpler solution here is using Greenfoot.delay(int) where the number specifies the number of time steps to delay. The lenght of one time step can be adjusted using the ui slider or using Greenfoot.setSpeed(int). Example implementaion:
81
82
83
84
85
86
87
X