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 add actors in the same place as before
By RandomGuy, with 2 replies.
Last reply by RandomGuy, almost 2 years ago:
Dude thank you so much!
I need an actor to follow an other actor
By gijsdevries, with 2 replies.
Last reply by danpost, almost 2 years ago:
gijsdevries wrote...
<Code Omitted>
The condition here will ALWAYS be
true
(if you have a class called
Player
).
I want an actor to apply a "rooted" status condition when it touches another actor
By KCee, with 5 replies.
Last reply by danpost, almost 2 years ago:
KCee wrote...
Here is the SuperSmoothMover class: << Code Omitted >>
Okay. Try the following for line 35: <Code Omitted>
triangles
By LucarioCodes, with 6 replies.
Last reply by danpost, almost 2 years ago:
LucarioCodes wrote...
Oh, thanks, sorry, I'm new to greenfoot
Line 10 should end with an opening bracket --
{
why doesn't my code work
By Magzlum, with 9 replies.
Last reply by danpost, almost 2 years ago:
Magzlum wrote...
do you have a good and easy idea for a game that i can make for school
Avoiders are the easiest type to create. Adding some type of shielding might be an easy idea. Or, you could add shooting ability to the player, which would be a slight step up. You could continue to add other options later, which again will be stepping up.
code has error
By Merten, with 3 replies.
Last reply by danpost, almost 2 years ago:
Merten wrote...
i<Code Omitted>
This code, in your
Fighter_Kogel
class, should be removed if you want the instances to move and get removed at edges like a
Kogel
instance is programmed to do. As an alternative, you could change it to: <Code Omitted>
Call getIntersectingObjects() from a subclass of World
By MRCampbell, with 1 reply.
Replied to by danpost, almost 2 years ago:
MRCampbell wrote...
getIntersectingObjects() is protected, so I can not call it from a subclass of World. I was reading the article below... << Link Omitted >> and would love some more context and to know if there is anyway around it.
I do not know what more can be said about accessibility. However, to get "around it", you could add a new method in the class of the actor to call the method and return its results: <Code Omitted>Then call this method from the world subclass.
How to fix shaking objects
By Armetor, with 4 replies.
Last reply by Armetor, almost 2 years ago:
Ohhhh ok that makes sense. Thank you so much!
Dark Maze
By CookieMonster, with 3 replies.
Last reply by danpost, almost 2 years ago:
One way is demonstrated in my new scenario,
Dark Maze Demo
The
Light
class in the scenario (in the
Player
class) was modified to allow changing the range of illumination (strength of light). Also, the
Scroller
class was fitted to support non-scrolling areas along right and bottom edges of the world (a
crop
method was added).
Greyscaling an image
By LucarioCodes, with 2 replies.
Last reply by danpost, almost 2 years ago:
LucarioCodes wrote...
Trying to make an image gray like an old photo, but I'm stuck. This is the code I have so far, where do I go from here?
Not tested, but I believe if you just add the three color parts together and divide by 3, then use that value for all three parts should be close to what you want: <Code Omitted>
Ok new problem
By SeargentMitchell, with 2 replies.
Last reply by SeargentMitchell, almost 2 years ago:
thanks bruv
How would I go about initializing an actor in a world without using "new"?
By FJacobs, with 5 replies.
Last reply by danpost, almost 2 years ago:
FJacobs wrote...
Wouldn't I have to initialize each world and object like: << Code Omitted
You do not have to initialize the player again (only initialized in the starting world). That is, your line 5 is not needed to put a player in a different world. The line I provide previously will move the player from one world to the next. The new world does not have to create another instance of a
PurpleGuy
object. If it would make things easier, you could add a method to the different worlds to help move the player into each world:
Hey guys bit of a problem
By SeargentMitchell, with 1 reply.
Replied to by danpost, almost 2 years ago:
SeargentMitchell wrote...
I need help in making a working crosshair that follows the mouse and overwrites it too if possible. ... How would I go about making the crosshair
I do not believe greenfoot allows access to its
Component
objects; which means you cannot do anything about the cursor being used. You could create an
Actor
subclass whose behavior is to follow the mouse and whose instances have the crosshair image. You may want to increase the scenario speed a bit to help in delayed movement of the actor. There may not be a suitable mix of speed and performace for
How do I fix this null pointer execption?
By RomanDavis, with 8 replies.
Last reply by RomanDavis, almost 2 years ago:
Thank you.
Lists
By A_User, with 1 reply.
Replied to by danpost, almost 2 years ago:
A_User wrote...
How do you create a list l and then access a random element of that list?
The
java.util.List
class is abstract, which means you cannot directly create a
List
object from that class. You can create a
List
object via a non-abstract class that extends the
List
class, such as the
ArrayList
class): <Code Omitted>You could import the two packages: <Code Omitted>to simplify the line to: <Code Omitted>
21
22
23
24
25
26
27
X