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
Issues with my game
By PatrickTheCoder, with 1 reply.
Replied to by Super_Hippo, about 7 years ago:
Why don't you ask your question here?
How to use JOptionPane after using removeTouching?
By marscentric, with 1 reply.
Replied to by nccb, about 7 years ago:
It doesn't have a yes/no option, but in general, Greenfoot.ask() is easier than JOptionPane. In modern versions of Greenfoot there are issues to do with window ordering if you try to use dialogs in your code.
Get clicked image name
By ChaosPhantom, with 3 replies.
Last reply by Super_Hippo, about 7 years ago:
<Code Omitted> Then you have several options. You can check for a click here in this class. Then either send it to somewhere else to check with the list or check it from here. Or you check for the click on this object from somewhere else.
Non static method cannot be referenced from a static context
By jrome, with 1 reply.
Replied to by Super_Hippo, about 7 years ago:
"static" can be translated with "belonging to a class". Static variables are shared with all members of the same class. If every object of the same class has its own value for the variable, it can't be static. It is basically the same for methods. Methods can be static when they don't use anything non-static. For example a method like "getX()" is not static, so you can not use "ClassName.getX()". An Actor is in the world and has its X-coordinate. If there are several Actors of this class in the world, each of them wants to move separately. To use a non-static method, you need to call the metho
Prevent overlap of objects
By Çðæyœn, with 26 replies.
Last reply by danpost, about 7 years ago:
Instead of spawning an array of 7 or so asteroids at a time, would it not be easier to just spawn one at a time at regular intervals? That would avoid the mess of having to know when to spawn again.
Spawn Monsters with Timer
By Verglas, with 3 replies.
Last reply by Super_Hippo, about 7 years ago:
Well, the problem is the "while". No matter what
counter
is at the beginning of the act method (1000 at the beginning or 60 every other time), it will be 0 after line 22. And yes, the act method is called around 50-60 times a second when the speed slider is at 50.
Need help with Shooting Direction of my Actor ( Car fight)
By Wellvyre, with 4 replies.
Last reply by Wellvyre, about 7 years ago:
THANK YOU the reference is needed for sth. later on but im glad you helped me there this school project was about to stress me out since i have limited time and i needed that rly fast to keep on going with the rest.
Help with walls
By jrome, with 5 replies.
Last reply by danpost, about 7 years ago:
jrome wrote...
Is there a way to detect what direction the object you are in contact with is from the character?
The character's direction of movement can be used to determine that. If character had moved up (dy < 0) then any obstacle encountered would be above the character.
Zombie game
By Anna_p, with 18 replies.
Last reply by Anna_p, about 7 years ago:
danpost wrote...
Anna_p wrote...
I wanted the zombie to chase the character and it does, except that when the zombie turns around while it moves. I was wondering if you could help me make it walk in a normal way.
Maybe adding the following line at the end of the ZOMBIE1 class act method might help: <Code Omitted>
I am now trying to make the zombies recognize the objects of the world. I thought about using isTouching like I did for the character except that I don't know what to put after the isTouching for the zombie for it to continue moving. I thought you might
Need help with ArrayList
By ChaosPhantom, with 7 replies.
Last reply by danpost, about 7 years ago:
ChaosPhantom wrote...
Alright, thank you! Also, its meant to be <Code Omitted>
Remove the '
+1
'. The last element is indexed one less than the length of the array (since counting starts at zero).
Problems Loading Next Level
By Radical-Shadow, with 3 replies.
Last reply by danpost, about 7 years ago:
Radical-Shadow wrote...
That makes sense. Do you know if there's any way to minimize that lag?
Process the level change in a different method (other than the
act
method). The
act
method is called continuously by greenfoot while the scenario is running; other method are only called when needed.
Changing Ships
By Joyfu1, with 3 replies.
Last reply by danpost, about 7 years ago:
Joyfu1 wrote...
The image is a total single image.
Okay, you can either check the location of the mouse when it is clicked, and act upon it if in one of the specified areas, or you can add "hit-box" actors into the world and check for clicks on them. Now, what exactly do you mean by change the health bar if it was created in greenfoot? and when would you want to do it?
X,Y coordinates
By PurpleFrozone, with 4 replies.
Last reply by danpost, about 7 years ago:
Super_Hippo wrote...
Well, I meant that the X-coordinate where the object will be added equals the width of the world. Similar for how I described the Y-coordinate. Didn't think one could get confused by my formulation given the fact that it fits the question pretty well.
I agree that your response fit the question. I just felt clarity was important. Some of those new to greenfoot take a while to get things (if at all). Not saying this is one of them.
Need help with actors
By Elijahmendoza, with 1 reply.
Replied to by danpost, about 7 years ago:
Elijahmendoza wrote...
Can an actor access another acting without extending it? Sorry, I’m new.
Extending is not used for providing access -- it is only used for inheritance. Getting references and using public methods (or fields) provide access. You will have to provide details for quick decent help.
Export to JS without Uploading
By SimonWalls, with no replies.
How can I transpile my Greenfoot project to JS without uploading it?
181
182
183
184
185
186
187
X