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
Why do I get a NullpointerException here?
By KaeptnMlapa, with 3 replies.
Last reply by KaeptnMlapa, about 9 years ago:
So it actually said "true" but I noticed that I made a basic mistake in my structure, so I had to put the array in another class and now it works. But still thank you very much for your try to help me!!
Why do I get a NullPointerException here
By GreenfootNewbie2000, with 8 replies.
Last reply by danpost, about 9 years ago:
Okay -- so line 25 creates a HIGHSCORE object and line 27 invokes the 'showHighscore' method on that object. However, the method cannot execute properly because it invokes the 'addObject' method on the value returned by calling 'getWorld'. But, 'getWorld' will return 'null' -- not any World object because the HIGHSCORE object is never added into any world. You cannot invoke any method on a 'null' reference.
I need some help creating a timer that counts down.
By jeremyq1900, with 3 replies.
Last reply by danpost, about 9 years ago:
danpost wrote...
If you cannot view it on the site, go to my tutorial site,
here
.
The site name has been changed, you can now access it
here
.
Title/Start screen
By SchoolStuff, with 38 replies.
Last reply by Yehuda, about 9 years ago:
danpost wrote...
The message is telling you that the problem is in the act method of the Block class -- line 48 at the time the last terminal error printed, as per this line: <Code Omitted>line 4 above.
The way the terminal works by me is the newest output gets added to the bottom, it doesn't push all the old stuff down and go to the top.
How to spawn something like a firebolt out from a character in any of the cardinal directions?
By Sirpancakeking, with 7 replies.
Last reply by Super_Hippo, about 9 years ago:
The code I gave you should be placed in the act method of the one which shoots the fireballs, so the mage. <Code Omitted> getX and getY takes the position of the mage which will then be used as coordinates for the fireball.
Mouse Clicked on Actor?
By Katht99, with 2 replies.
Last reply by danpost, about 9 years ago:
You cannot compare an image to a String (lines 26 and 45). Lines 34 through 37 should be in the act method of the Note class. Lines 26 through 31 should be removed and the following should be added after line 33: <Code Omitted>Lines 47, 48 and 50 can be removed; but I do not know what you can replace line 45 with. Lines 56, 57 and 60 can also be removed.
Battleship game world constructor
By ironphoenix20, with 28 replies.
Last reply by danpost, about 9 years ago:
It is definitely your 'addShips' method that is troublesome. I would have used something more along this line:
A better alternative to getOneAtOffset?
By Dudesame, with 2 replies.
Last reply by Dudesame, about 9 years ago:
Works like a miracle, thank you.
Simple Threading in Greenfoot
By MrBradley, with 4 replies.
Last reply by Super_Hippo, about 9 years ago:
I wish my teacher had any knowledge about programing when he introduced GF to us... It looks like you know what you are doing and hopefully your students can follow your thoughts. Usually you will get an answer like "Greenfoot is not thread-safe" from the GF team. Since I am not really into this, I can't tell you what you can do against this... GF is for beginners and that's why it gives you an environment without the need of using complicated java things. When I tried porting GF scenarios to android using Droidfoot, I had to use eclipse and I didn't have a clue about anything. I probably wou
When keypress not after keypress?
By Sylva, with 3 replies.
Last reply by Sylva, about 9 years ago:
Thanks for the help danpost. It works and feels much better now :D.
get one intersecting object confused me
By lookaround, with 10 replies.
Last reply by Super_Hippo, about 9 years ago:
There are actually a lot of methods which do that already. And I think they added it with the new API (even though I am not sure). For example the getObjects method in World. It returns a List of the type you pass. So this one works without casting: <Code Omitted> However, it only works for methods which return a List, not for those which return one single object. So this line does not need a cast: <Code Omitted>but this one does:
Changing between a pistol and an rifle
By Dudesame, with 4 replies.
Last reply by Dudesame, about 9 years ago:
Ah ok. thank you for my help. here is the finished code for those wondering.
Battleship Game
By ironphoenix20, with 35 replies.
Last reply by danpost, about 9 years ago:
The source was not uploaded. And it seems to be running an infinite loop on World construction.
i want re use the button up,left,right,down for next level please help me
By dadansi, with 9 replies.
Last reply by Yehuda, about 9 years ago:
So if that's what you want to do then do it. danpost's code should be in the World that you want to host these arrows.
Spongebob Jumping game
By Bobby, with 3 replies.
Last reply by danpost, about 9 years ago:
When does it become gray? * when you compile (are the execution buttons grayed also)? * when you try to jump? * some other time? Be specific. However, it may be related to some code in your World subclass (which you have yet to post).
336
337
338
339
340
341
342
X