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
Control Redirection to Multiple Worlds with One Method.
By Lewis12374, with 1 reply.
Replied to by danpost, almost 7 years ago:
Lewis12374 wrote...
I'm trying to achieve making my menu as abstract as possible, but I cannot seem to find a way around doing so. This is what I have tried so far, with no progression. Please help? << Code Omitted >> The error received is: '(' or '' expected on the SuperClass.
The compiler is expecting a class name followed by a parameter list (a set of round parentheses that may or may not contain any elements). It has yet to complain that you use a String object for the name or that it cannot find a class named "HelpScreen" (including the quotes) -- I suspect it will do one or th
Image
By Adi18, with 5 replies.
Last reply by danpost, almost 7 years ago:
Adi18 wrote...
Thanks. That could be a problem because I want to do something like a character can only jump to the top of the image, but if it touches the left, right or down side is put aside
For that, all you really need to know is the direction that the character moved. For example, if moved right and touches the object, then the object is to the right. Same goes for the other directions. As long as you adjust the position of the character such that it no longer touches the object (moving opposite the initial direction moved), you should not have any issues.
How can you keep variables between worlds
By iminblue, with 21 replies.
Last reply by iminblue, almost 7 years ago:
danpost wrote...
iminblue wrote...
I did it just as you said : addPlayer is in the World's code , and I try to call it from a method inside the Player class : << Code Omitted >> Using this directly in the act() method doesn't work either.
In line 3, you are trying to call
addPlayer
on an object of type
Class
(called
yeet2
). This will not work -- you cannot add a player to a class; you can only add a player to an object of type World (or, in your case, specifically, a
yeet2
world instance). You create one on line 2 and name it
w2
. That is what you
Problem with Object Interaction
By wueschn, with 4 replies.
Last reply by wueschn, almost 7 years ago:
Thanks a lot, what a silly mistake.
Wombats and Leaves Fighting for a Leaf
By frogfrog, with 1 reply.
Replied to by danpost, almost 7 years ago:
Probably depends on the order you placed the wombats into the world.
Wombats and Leafs Limit Question
By SilentHunter115, with 1 reply.
Replied to by danpost, almost 7 years ago:
You could add the following as the first line in the foundLeaf method, to prevent "seeing" the leaf when count is 2: <Code Omitted>
Question
By tuffguy5, with 1 reply.
Replied to by danpost, almost 7 years ago:
You would probably need to use the
getNeighbours
method, determine if the list returned was empty or not and, if not, (randomly?) remove (eat) one that is in the list.
Wombats facing each other
By lucky555, with 1 reply.
Replied to by danpost, almost 7 years ago:
You could vertically mirror the image of the one on the right: <Code Omitted>However, this will probably redden the image and the mirroring would need done every time the wombat faces the opposite direction. Better would be to have two
GreenfootImage
fields in the class to hold a right-facing and a left-facing wombat. On any turn to 0 or 180 degrees, set the appropriate image.
Moving The Wombat
By Baseball19, with 1 reply.
Replied to by danpost, almost 7 years ago:
Make line 40: <Code Omitted>
Change background in leaves and wombats
By Ravens52, with 1 reply.
Replied to by danpost, almost 7 years ago:
Remove line 18.
Disappearing Wombats
By Bicpen6, with 1 reply.
Replied to by danpost, almost 7 years ago:
Bicpen6 wrote...
In the Wombat and Leaves game, why do some of the wombats disappear after going around in a circle?
They are probably on top of each other (one hidden behind another).
Speed Of Rocket
By FlyersFan53, with 1 reply.
Replied to by danpost, almost 7 years ago:
You could make it any value you want; but it would help to make it a reasonable one. An initial value of zero is always a fair option.
Updating Instances of Classes
By Targetplaz, with 1 reply.
Replied to by danpost, almost 7 years ago:
Many ways. It would depend on how many wombats you want to be eaters (at one time); whether (and when) their eating status could change (among other things.
Actor Acceleration Question
By Kakorat859, with 1 reply.
Replied to by danpost, almost 7 years ago:
Just add the condition along with the thrust key being down that the speed is less than whatever max value you are setting. For example: <Code Omitted>
Leaves and Wombats (Wombats Lagging)
By JVaro573, with 1 reply.
Replied to by danpost, almost 7 years ago:
I guess you could make the leaf image somewhat transparent. That way, when two are together, it resultant image will appear darker than the rest.
214
215
216
217
218
219
220
X