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
using up/right arrow keys to get movement in that direction
By LukeCrawford, with 1 reply.
Replied to by danpost, over 12 years ago:
Start with base offsets for x and y initially set to zero. Adjust those values depending on the keys pressed. Then use the final results to determine the direction of movement.
Problem
By Ploppy, with 4 replies.
Last reply by danpost, over 12 years ago:
I would like to know if you would want to display to the player how many have been killed or if you just want to hold the value internally.
Is there a "keyPressed" method in Greenfoot?
By Minion1, with 15 replies.
Last reply by actinium, over 12 years ago:
i get what you mean danpost !.
Making and using a list
By Minion1, with 12 replies.
Last reply by Minion1, over 12 years ago:
The game is shaping up pretty nicely! I'm very proud even if it is not really much of a game. For my second game ever, it's not too bad. The hero can now move seamlessly between 9 areas, with 4 different monsters, one item to pick up, and even some music I added. I'm having a good time with this.
Why doesn't it work?
By Ploppy, with 2 replies.
Last reply by Ploppy, over 12 years ago:
THANK YOU! I'm still a beginner, :P
Image based reaction
By Miki, with 3 replies.
Last reply by Miki, over 12 years ago:
Thank you guys so much!!!!! :D
Maze Game Help
By iPixel, with 4 replies.
Last reply by ManiacalPenguin, over 12 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, over 12 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, over 12 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, over 12 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, over 12 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, over 12 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, over 12 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, over 12 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.
902
903
904
905
906
907
908
X