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
i have some problems with somthing i am doing
By 987987aris, with 1 reply.
Replied to by davmac, over 12 years ago:
It's just one error. At line 16 of your PlayerPink class, you are dereferencing a null reference. That is, you have obtained a null value and are trying to call a method on it (or access a variable with it).
java.lang.NullPointerException
- is the type of the error
at PlayerPink.act(PlayerPink.java:16)
- tells you where it happened The rest:
at greenfoot.core.Simulation.actActor(Simulation.java:568) at greenfoot.core.Simulation.runOneLoop(Simulation.java:526) at greenfoot.core.Simulation.runContent(Simulation.java:215) at greenfoot.core.Simulati
Enemies with A.I.
By exifern, with 8 replies.
Last reply by exifern, over 12 years ago:
Alright,thank you
Error message help
By Gingervitis, with 6 replies.
Last reply by Gingervitis, over 12 years ago:
That actually worked. My loop had a wrong value in it. Thank you for the help!
Help With Paint Order Of Individual Objects
By GunShow124, with 4 replies.
Last reply by danpost, over 12 years ago:
Your null pointer was probably due the 'getWorld' not being able to get the World object that the actor was in after it was removed from the world. Get a reference to the world before removing the actor: <Code Omitted>
Use var from method in act() in world class
By mrunknown, with 31 replies.
Last reply by danpost, over 12 years ago:
If you use 'static' fields and methods in your Main class for the scores and names, you will be able to change them directly from the Plane class using 'Main.staticMethodName()' or 'Main.staticFieldName'. My
Pushy Woman
scenario has an example of how that works in the Maze class (I think that is where the 'static' fields for best scores are located).
How to remove a JButton from my card layout.
By JasonZhu, with 3 replies.
Last reply by JasonZhu, over 12 years ago:
It works wonders. It beats deleting then having to replace the button by a long shot. Thanks a lot.
How do I let new snake circles follow the first one?
By Osso, with 1 reply.
Replied to by danpost, over 12 years ago:
One thing, first. In the act method, you are using both 'move' and 'setLocation'. You need to use one or the other, but not both; and, the preceding code should be geared toward that end. You should get the movement right for the head of the snake before moving on to trying to move an entire 'multiple section' snake. Since you are using only NORTH, SOUTH, EAST and WEST directions, using 'setLocation' with 'dx' and 'dy' would be the way to go.
Is there an easy way to do side scrolling
By n1nikko, with 4 replies.
Last reply by n1nikko, over 12 years ago:
danpost wrote...
Well, no scroller is easy and unfortunately, that (specifically) is one type I do not have an example of on the site (although I have several scrollers with source available -- some side-scrollers and some universal). My
Timed Scrolling
scenario is the closest thing I have up; but, it is a universal scroller. I would, however, contain everything you would need to learn from.
thanks
Danpost this is my problem
By docinkc, with 2 replies.
Last reply by docinkc, over 12 years ago:
danpost wrote...
You copied line 12 incorrectly.
Thank you!
Need help switching spirtes when i change directions
By n1nikko, with 5 replies.
Last reply by n1nikko, over 12 years ago:
Thanks a lot it worked, and do you know how to do side scrolling?
Farrukh stole my scenario.
By Entity1037, with 7 replies.
Last reply by davmac, over 12 years ago:
There was no response from Farrukh and I have had to disable the account.
Help with 2048
By midnightocean, with 6 replies.
Last reply by danpost, over 12 years ago:
An easier way to go about executing a move is to keep track of (1) how many blocks have been moved; and (2) the value of the last block moved. If moving up, then, for each column. start at the top and working down (a) check for a block and if encountered, if the last block value equals this block value, remove this block and double the last block value (the block can be located by the value of the number of blocks moved or it can be held in a field). Once a combining has occurred, set the last block value to zero. If not combining, set its location, bump number of blocks moved and set last
Method cannot be applied
By Hutanoi, with 6 replies.
Last reply by lordhershey, over 12 years ago:
@danpost I still have a Tandy 1000 SX , the thing still works, I was thinking of pulling it out a doing some basic programming on it for kicks. It has no mouse, I did upgrade it several times, put a 20 Meg Hardcard in it, ram up to 640K, replaced 1 of the 5 1/4 inch drives with a 3 1/2 720k drive. Only thing I did not do was put extended memory in.
Objects so einfügen dass sie einen Abstand zu dem oberem und unterem Rand haben
By skaterboy88, with no replies.
Hallo ich habe sogenannte Fliegen implementier mit der Methode public void verteileFliegen() { List listeFrosch, listeKescher, listeKescher1,listeKescher2, listeKaktus; int x,y; for (int i=0; i<25; i++) { addObject(new Fliege(), Greenfoot.getRandomNumber(getWidth()-40), Greenfoot.getRandomNumber(getHeight()-40)); } do{ x = Greenfoot.getRandomNumber(10); y = Greenfoot.getRandomNumber(10); listeFrosch = getObjectsAt(x,y,Frosch.class); listeKescher = getObjectsAt(x,y,Kescher.class); listeKescher1 = getObjectsAt(x,y,Kescher1.class); listeKescher2 = getObjectsAt(x,y,Kescher2.class); listeKaktus = getObjectsAt(x,y,Kaktus.class); } while(! (listeKescher.isEmpty() && listeKescher1.isEmpty() && listeKescher2.isEmpty()&& listeFrosch.isEmpty() ) ); } Doch leider setzt es die Fliegen ab und zu auf den Rand meines Spielfeldes was ziemlich kacke ist... was kann man da machen?
Remove all Objects
By skaterboy88, with 2 replies.
Last reply by skaterboy88, over 12 years ago:
Vielen Dank
676
677
678
679
680
681
682
X