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 pause if you click the pause button?
By ZeroMark, with 3 replies.
Last reply by Venbha, almost 9 years ago:
danpost wrote...
It is like a toggle -- on, off, on, off...
is it like this scenario?
See my scenario here
It has a switch
it spins only when it is switched on.
PS-Is it LIKE this scenario?
Multiple Animations
By Ethannnn6122, with 1 reply.
Replied to by danpost, almost 9 years ago:
One problem is with the conditions used in your animation methods. In leftPunch and walkLeft, no matter what the number of frame below number of images in set times the delay, the last 'if' condition will end up to be true -- and its image will be what you end up viewing. Change "<' to ">' (or ">=') so all images in a set will be viewed at some point. In other methods, you are using '==', which is not only inconsistent, but may not work when changing from one image set to another.
java.lang.NullPointerException
By Omeged, with 3 replies.
Last reply by danpost, almost 9 years ago:
Omeged wrote...
Thanks. But it didn't works. Greenfood said: "cannot find symbol - variable gray"
Try 'GRAY', with all caps ( or 'new Color(128, 128, 128)' ).
Need help with crab code. Trying to move a certain way
By Pooky, with 2 replies.
Last reply by Pooky, almost 9 years ago:
Thank you!! That totally worked. I had a complete brain fart earlier while trying to work on this.
Make Wombat move to every spot
By ZigZagNinja, with 1 reply.
Replied to by danpost, almost 9 years ago:
ZigZagNinja wrote...
So maybe this scenario is a little outdated but in the Wombat scenario I want to place the Wombat anywhere in the map and he“ll move to every single spot in the map so he can eat every leaf in the map if the hole map is filled with them. How do i change the Wombat source code, sothat he will do this?
There are multiple ways to accomplish this. There are adding random turns; or moving random distances; or finding a corner and zig-zagging across the rows or columns; or finding a corner and counting steps across and down to spiral in toward the middle. I am quite sur
maze game
By Enrique, with 2 replies.
Last reply by danpost, almost 9 years ago:
In the act method of the class of the moving actor: <Code Omitted>
Making a check if a list is empty
By GustavoA, with 3 replies.
Last reply by GustavoA, almost 9 years ago:
I made a rework that made it work. Removed the GameSettings class and moved the scoreboard etc. to my world subclass.
Maths Quiz Game
By Joaquin, with 6 replies.
Last reply by danpost, almost 9 years ago:
Timers and Lives are basically values that are displayed and used to control the game. You could check out
my tutorial
. It should, in general, help. EDIT: minor adjustments might need to be made to the given code due to the version of Greenfoot you are using.
showText from an actor
By GustavoA, with 2 replies.
Last reply by danpost, almost 9 years ago:
GustavoA wrote...
Managed to make it work. Pretty sure I called it in the constructor, which gave this issue.
That is precisely why.
at WombatRight.<init>(WombatRight.java:32)
The '<init>' in this line means that the constructor of the WombatRight class was being executed when the error occurred. The actor being created has yet to be placed into a world and cannot have its 'getWorld' method return any world at that time.
nullPointerExeption
By Nosson1459, with 1 reply.
Replied to by danpost, almost 9 years ago:
Your 'getX' and 'getY' methods in the Object class are trying to return a value from an actor that may or may not be present. If one is not present, you cannot possibly use 'calcX' on 'actor'. Check to make sure 'actor' is not null before calling 'calcX' on it. However, I do not know what value you would then return. Maybe return an Integer object instead of an int value so 'null' can be returned and the calling method can deal with that possibility. As a sidenote: I would refrain from using the name 'Object' for a class as ALL classes are already subclasses of an 'Object' class.
Greenfoot.isKeyDown only working sometimes
By dan_fred, with 3 replies.
Last reply by dan_fred, almost 9 years ago:
I don't really understand the code that you suggested, but thank you. I think it's a problem with the intallation of Greenfoot. I' using it on a school computer so I think it has something to do with that. My code should work. Thank you for your help.
Is there a way to increase the overall size of the world?
By Kamichalik, with 2 replies.
Last reply by Kamichalik, almost 9 years ago:
Ok thanks.
stop image orientation changing
By greennotpurpleaki, with 6 replies.
Last reply by greennotpurpleaki, almost 9 years ago:
Bingo! Thanks very much for this
Call overloaded subclass method from getOneObjectAtOffset
By Comwp, with 2 replies.
Last reply by danpost, almost 9 years ago:
Comwp wrote...
Actually i just found out how to fix it < Code Omitted > works just fine. maybe it was casting it? No idea, i am all ears at alternative or rather, quicker ways though.
Actually, casting it is what fixed it. The compiler did not know to look in the btn_ class as the reference in your first post was to an Actor type object (the return type of 'getOneObjectAtOffset') -- not a btn_ type object.
Platform runner
By saltyscrub, with 1 reply.
Replied to by danpost, almost 9 years ago:
An endless map is just an unbounded world in which a tiled (in a matter of speaking) background image can be made to move with all actors considered to be in the game moving with the background. Usually, this happens when the main actor is found to be outside its given bounds and the adjustments are to correct the placement of that actor (so that it remains within the limits of the bounds set for it. This is essentially scrolling the world and the world object will usually perform that function. I have done some tutorials both on scrolling and on gravity which may give you some insight on
326
327
328
329
330
331
332
X