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
wombats2 how to make the Wombat smarter
By jjimenez77, with 3 replies.
Last reply by danpost, about 13 years ago:
The following will find the closest leaf and then make a move toward it (if any found).
Barrier help
By GrimCreeper312, with 13 replies.
Last reply by danpost, about 13 years ago:
Yeah. What you probably should have done, instead of creating a seperate class for each of the Pic#s, is create one class (I would call it Mimic, because it mimics the image) and create one instance of it when the mouse is over a button. Pass it an object of the class the button refers to in the parameter so it can access its image.
How to find actors in radius?
By GreenGoo, with 1 reply.
Replied to by davmac, about 13 years ago:
I need it to return a boolean
You can't make a method return a different type to what it does return. I think what you probably mean is, you want to check whether there exist any actors in a certain radius. In that case, just call getObjectsInRange() and call isEmpty() on the result to check whether there are no actors in range. <Code Omitted> ... will set result to true if there are any actors within a 100 cell radius.
Text input with actors.
By Kiara, with 8 replies.
Last reply by Kiara, about 13 years ago:
THANK YOU!! :)
Jumping
By Kiara, with 6 replies.
Last reply by Kiara, about 13 years ago:
Ummm... I'm not doing this scenario anymore. Thank you both for your help, though.
Creating squares
By mattjames, with 3 replies.
Last reply by mattjames, about 13 years ago:
That's great thanks.
How to display the cursor?
By Kartoffelbrot, with 8 replies.
Last reply by danpost, about 13 years ago:
Please refer to the
Cursor class documentation
for extra info you may want to know about.
Writing lines in a textfile
By Ragtime, with 3 replies.
Last reply by davmac, about 13 years ago:
Technically you should use '\r\n' for Windows text files and just '\n' for Mac / unix style text files. However, as Gevater_Tod says, it will usually work just fine if you use '\n'.
Turns
By JetLennit, with 5 replies.
Last reply by davmac, about 13 years ago:
abilities :p
Java book
By martijn13039, with 4 replies.
Last reply by danpost, about 13 years ago:
The code used in Greenfoot
is
Java code. So anything you learn there (at least as far as the basics are concerned) should assist you in programming in Greenfoot.
Boss moving
By GrimCreeper312, with 3 replies.
Last reply by danpost, about 13 years ago:
Put a small transparent object at each place where the actor is to turn; if your actor moves faster than one pixel per act, use a 'for' loop to move one pixel at a time and check for intersection with transparent object. When object found, turn number of degrees required. For variance, you can specify the number of degrees to turn within the transparent object (or just specify the new direction of travel). If necessary, you can adjust the actor to the location of the transparent object to maintain the same line of travel each time around the path. The 'for' loop is unnecessary if you make
Adding objects
By Kiara, with 6 replies.
Last reply by danpost, about 13 years ago:
@FlyingRabidUnicornPig, that may not do what Kiara wants. With that, There will never be more than one spider and having a reference to one Spider object in the world class will not work when there is more than one in the world. Better, would be just for Kiara to use the code that he has, with one addition (referencing the world):
How to create scenario?
By didimak, with 5 replies.
Last reply by Kiara, about 13 years ago:
click 'scenario' at the top of the screen, then press 'new'.
mouse Help
By GrimCreeper312, with 5 replies.
Last reply by danpost, about 13 years ago:
Sorry, try changing line 9 to the following: <Code Omitted>
Making Asteroids, gameplay stops midplay when bullet hits asteroid
By Griffon305, with 1 reply.
Replied to by danpost, about 13 years ago:
There is an Actor class method that you can use to get the world the actor is in, if it is in one. If the actor is not in any world the method will return 'null'; if it is in a world, then that world will be returned. The method is 'getWorld'. Change your last line in your act method to: <Code Omitted>or, change your act method to the following: <Code Omitted>
862
863
864
865
866
867
868
X