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
Maze Game Help
By iPixel, with 4 replies.
Last reply by ManiacalPenguin, almost 13 years ago:
to stop an Actor from passing through walls, first create a variable to store x and y: private int x; private int y; the method is: public void stopAtWalls() { if (getOneIntersectingObject(Wall.class) != null) { setLocation(x,y); } else { x = getX(); y = getY(); } }
pathfinder
By ManiacalPenguin, with 3 replies.
Last reply by MatheMagician, almost 13 years ago:
Here is what your new class should look like:
A question about coding.
By hkrhässleholm, with 1 reply.
Replied to by vonmeth, almost 13 years ago:
Erm, can you show an example of the code you are using that is not working, as it should work, if I am understanding your explanation correctly.. There is no reason for there to be brackets around move();.
How to add a counter?
By SophieMarie777, with 3 replies.
Last reply by SophieMarie777, almost 13 years ago:
Yay! Thank you, Penguin-man!
How to let pacman stop moving when he face a wall
By Rexsar, with 4 replies.
Last reply by ManiacalPenguin, almost 13 years ago:
First thing to do is to create a variable to store X and Y values. private int x; private int y; you can use any method to move that you want, for example: if (Greenfoot.isKeyDown("right")) { setLocation(getX() + 5, getY()); } the stop at walls method should look like this public void stopAtWalls() { if (getOneIntersectingObject(Wall1.class) != null || getOneIntersectingObject(Wall2.class) != null) { setLocation(x,y); } else { x = getX(); y = getY(); } }
Display Crab lives
By Peach, with no replies.
I need to enhance the crab scenario by: 1) Displaying the number of Crab Lives on screen using the SimpleCounter (a support class) 2) Making the Crab have five Lives. Each time a Crab is eaten, a new Crab is added at a random location, and the Live count is reduced by one. How can I do this? Please give me the code. Thank you!
Making a world map.
By Minion1, with 15 replies.
Last reply by danpost, almost 13 years ago:
There really is no problem with clearing the world. If in the hero class: <Code Omitted>This saves the location of the hero and saves a reference to the world; then removes all objects, creates the new area and re-inserts the hero at the same location it was removed from.
Java
By joseph.stafford2@waldenu.edu, with 1 reply.
Replied to by danpost, almost 13 years ago:
Make sure your bracketing is proper. If not resolved, post your class code.
Okay, In my scenario people are able to get sick by touching a Mikrobe.class . When they get sick there is an image change and they turn green. I want that the Mikrobe.class only eats the green people. How can I do that?
By kaatja, with 1 reply.
Replied to by danpost, almost 13 years ago:
You will have to somehow keep track of the current state of the actor; whether it be a boolean that holds a true/false value of the state 'isSick' or a String that holds the current name of the file the image of the actor is set to. The value of this new field can then be used to determine if the actor is currently sick. It will have to be set to 'true' when first contracting a mikrobe.
How do I upload a Scenario to test?
By askgriff, with 1 reply.
Replied to by askgriff, almost 13 years ago:
OMG... never mind. Share button. LOL I feel like one of my students.
In my scenario people are able to make "childs". But instead of making one child, they're making 5-10.
By kaatja, with 3 replies.
Last reply by danpost, almost 13 years ago:
Change <Code Omitted>to <Code Omitted>
Ich möchte, dass mein Baby.class wächst zu einem Kind.class, weiß aber nicht, wie ich die grow Methode hier anwenden soll..
By kaatja, with 8 replies.
Last reply by danpost, almost 13 years ago:
<Code Omitted>I condensed the code so it would not take so many lines (I had to properly indent the code anyway, so I could check the bracketing). You do no
I want my baby.class to grow to a child.class but I dont know how to use the grow method..
By kaatja, with 2 replies.
Last reply by kaatja, almost 13 years ago:
it is ! .. but it doesnt work
Creating a new button in menu
By LordBeno, with 1 reply.
Replied to by danpost, almost 13 years ago:
In your 'Background' constructor, add the statement that adds the new object to its world.
Null Pointer Exception for what?
By Entity1037, with 3 replies.
Last reply by Entity1037, almost 13 years ago:
Thank You. Actually the problem is so simple, I'm surprised I didn't figure it out! Oh well :/
905
906
907
908
909
910
911
X