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
GridBagConstraints.BOTH
By Nosson1459, with 8 replies.
Last reply by danpost, over 9 years ago:
Nosson1459 wrote...
So how does getting a NullPointerException help anybody? The method was created by
Java
just so that I can have fun getting NullPointerExceptions?
I think you know that is not the point. It allows you, if you had a Dimension object, to use it instead of extracting the values from it to set the size of a component. I suspect that the implementation of other methods within the 'awt' package utilize the 'setSize(Dimension)' method as well (like in 'pack' when there is a preferred size given by a Dimension object).
when is it decided to not use the prefe
Greenfoot.getMouseInfo() returns null problem
By perhapss44, with 2 replies.
Last reply by danpost, over 9 years ago:
Super_Hippo wrote...
Greenfoot.getMouseInfo() returns the current state of the mouse.
To elaborate, if no mouse action is detected (basically any movement or clicks), no MouseInfo object will be returned and the value of the reference will be 'null'. Otherwise the last action would continue to be returned, where it may no longer be the current state of the mouse. I usually use a combination of 'mouseMoved' calls to determine hover state; however, using a field to keep track of the current state is useful to determine the exact moment the state changes.
How to make my character jump?
By AntoniaPopa, with 1 reply.
Replied to by Super_Hippo, over 9 years ago:
1. There is probably some rule which permits using that name for the character. 2. Try to search for your problem here on the website. There are plenty of discussions around making a character jump.
Combat system
By AuroraGamer, with 3 replies.
Last reply by danpost, over 9 years ago:
Lines 49 in your LevelOne class is executed every act cycle. Nothing is restricting the incrementing of 'levelUp' there. So, every third of a second or so, the counter will be added to without regard to anything else. That is the explanation for the continuing counter. How to fix it is not really clear because of the lack of detail in what you actually want. Obviously, you are counting 20 of something and they are not supposed to be act cycles -- but, what they are is unclear (and 20 is not 10, which you stated were the number of enemies killed before leveling up -- a bit confusing!).
Jumping animation problem
By Hondrok, with 4 replies.
Last reply by Hondrok, over 9 years ago:
danpost wrote...
Hondrok wrote...
Still not working
Remove line 81 in your last code post. Remove '&&' at the end of line 115 and remove line 116. Insert between lines 120 and 121, an 'else if' clause and repeat what is above it for right facing images.
it wooorks thank you a loooot dan
Problems with the Scrolling World
By max_thure, with 1 reply.
Replied to by danpost, over 9 years ago:
It might be best for you to upload the scenario with the 'Publish source code' checkbox checked so that we can investigate into the issue. I am not quite sure the problem is actually in the ScrollActor class. It would be quite difficult to reproduce the current behavior of the scenario otherwise.
Finding one Specific object
By BrownDwarf, with 12 replies.
Last reply by Super_Hippo, over 9 years ago:
Theoretically the getObjectsInRange should even return a List<RedBloon>. Well, I always need to test this, too. Your solution is good.
non static method cannot be referenced from static content
By FishEvolution, with 1 reply.
Replied to by davmac, over 9 years ago:
The variable is called "
z
eemijn" but you are calling the method as "
Z
eemijn.Remove()";
Z
eemijn is a
class
name, which is what it means by "static context". You should change the line to: <Code Omitted> Also, "Remove" is a
method
, not a class, and by convention it should also start with a lower case letter (but you would need to change the declaration as well as your reference to it here).
Make greenfoot.Font.Font(java.awt.Font) protected or even public
By barbu110, with 2 replies.
Last reply by davmac, over 9 years ago:
Also:
I can't find any usages of this constructor
It is used in the deriveFont method implementation, and for getFont in GreenfootImage.
but it is not protected or public so we can inherit from greenfoot.Font which is a pretty limited abstraction
I'm not sure what you mean by this. It is not intended that users extend (derive from) the greenfoot.Font class. Though it is possible to do so, it is certainly not intended that one could then call API-private methods. The package-private constructor that you found is an example of such a method. It is not pa
corpse party scrool map
By Alexlazea, with 2 replies.
Last reply by Alexlazea, over 9 years ago:
thank you
Pathfinding in a dynamic world
By Super_Hippo, with 1 reply.
Replied to by Super_Hippo, over 9 years ago:
For anyone who is curious, this idea is working now:
The next idea was to set the unit in the middle of its current position and the target and find all of those corner objects in a circle around it (maybe twice the distance between unit and target) with the 'getObjectsInRange' method and then calculate the distances between all of them to find the shortest route...
I only have to hope that it will still work if there are plenty units trying to find their way simultaneously.
How can I create a button
By Fifilein, with 13 replies.
Last reply by danpost, over 9 years ago:
Fifilein wrote...
danpost the methods from the button?
Please elaborate. I am not sure what you are asking here. Or, maybe you did not realize that 'here' in my last post is linked to a page.
Teleporting
By Greenfoot1234, with 8 replies.
Last reply by danpost, over 9 years ago:
Greenfoot1234 wrote...
thanks that works, but you can see pac teleporting is there a way to teleport whilst off screen, so it looks smoother, I have done this in the Stage by the way "super int, int , int, false" ? thanks
Just change the signs of all instances of '40' and '41' (they can be all '+40' and '-40' btw).
NullPointerException at the end of my game...
By TheGreenFoot, with 11 replies.
Last reply by TheGreenFoot, over 9 years ago:
Thank you so much for your help, works fine now!
getOneIntersectingObject
By NatNat, with 2 replies.
Last reply by danpost, over 9 years ago:
The 'getOneIntersectingObject method returns an object reference of type Actor; but, you are trying to assign it to a variable of type Tile -- hence, the error. Just change line 5 to the following so the compiler knows that the returned reference is for an object of type Tile: <Code Omitted>(maybe this is not the problem and generics takes care of this particular thing)
397
398
399
400
401
402
403
X