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
Saving an integer
By Ben&Sam, with 1 reply.
Replied to by danpost, about 12 years ago:
It would help if you show what you have tried (use the 'code' link below the reply box for posting code). The code for the pieces might be important; how many pieces created (or moving) might help; any extra information regarding what you are trying to accomplish (in general) might also help.
Movement like doorkickers
By JasonIsMobile, with 2 replies.
Last reply by danpost, about 12 years ago:
I need help making a scoreboard.
By zekromslayer, with 5 replies.
Last reply by jimboweb, about 12 years ago:
If you want to keep score during the game, I have made a downloadable ScoreBoard class that you might find useful. You can find the class here:
http://mrstewartslessons.com/useful_class_scoreboard.html
Simply download the class into your Greenfoot project folder. Close Greenfoot and open it again and you'll see the ScoreBoard class among your actors. Open its code window and change 'Source Code' to 'Documentation' and you'll see directions as to how to use it in your actor's code. It has various constructors that allow
Ship game help
By Fuzzion, with 1 reply.
Replied to by jimboweb, about 12 years ago:
I have made a MoveRandomly class that you can include in your Greenfoot project that will cause another actor to move randomly. The code can be found here:
http://mrstewartslessons.com/useful_class_moverandomly.html
Simply download the java file into your greenfoot project. Close greenfoot and reopen the project, and you'll see the MoveRandomly class among your actors. Open the code window and change 'Source Code' to 'Documentation' and you'll see directions for including the object and its methods in your actor's co
How do i make a random moving target and shoot rockets from another actor?
By Fuzzion, with 2 replies.
Last reply by jimboweb, about 12 years ago:
I've created some useful classes that will do some of what you're looking for. Two of them in particular. The MoveRandomly class can be found here:
http://mrstewartslessons.com/useful_class_moverandomly.html
and the Projectile class can be found here:
http://mrstewartslessons.com/useful_class_projectile.html
To use them, download the files into your Greenfoot project's folder. Close the project and open it again and you'll see the classes list
How can I call a variable int from an othe class?
By largowinch123, with 12 replies.
Last reply by danpost, about 12 years ago:
<Code Omitted>The above line can be used in your Crab class to obtain a reference to the counter. After that line you can call any public method on 'counter' ( counter.methodName(parameters); ).
Bouncing off of walls?
By JDSmooth, with 9 replies.
Last reply by jimboweb, about 12 years ago:
You might want to use the DriftMove class which I have created. It allows you to make an object drift on the screen and features a BounceAtEdge method that reflects at the angle that it hits the edge, just like a regular ball. It also allows you to set a random speed on spawning, and a number of other methods that might help. You can find it here:
http://mrstewartslessons.com/useful_class_driftmove.html
Select-click on the 'Download Class' and save it in your project folder. Close your project and open it again, and th
Changing color of my ball
By NIcolasGomez, with 9 replies.
Last reply by danpost, about 12 years ago:
You do not need a separate class for each color of the ball. Just change the image of the one Ball actor to change its color. Use the 'setImage' method supplying the String name of the file to change the image to. If you want the ball to alternate between the two colors as it hits the paddle, then hold both images in instance fields and set the image of the ball to one of them in the Ball class constructor. Then, when the ball hits the paddle, use the 'if' condition 'getImage() == image1' to determine which image to set (on 'true' result, set image to 'image2' else set image to 'image1')
Help Shooting Please!
By JamesHughes, with 2 replies.
Last reply by danpost, about 12 years ago:
The only thing you have to distinguish between a right or left facing tank is the image; so that will be the condition to use to determine the direction of the bullet: <Code Omitted>Now, this code needs to be within an 'if' block whose condition determines that tank is firing: <Code Omitted>where you write a method to return a boolean value (true or false):
Move error occurs when the bullet object is removed,this class extends the Mover class!! HELP PLEASE!!
By crinno, with 1 reply.
Replied to by Super_Hippo, about 12 years ago:
You can't call 'getWorld()' after you removed the object. You could add a line like 'if (getWorld != null)' in line 29 and 40.
I cannot understand paint method in greep scenario
By songgh1999, with 3 replies.
Last reply by danpost, about 12 years ago:
All you need do is put something like the following in the act method of the Greep class for a greep to spit: <Code Omitted>You will probably want to put a condition on calling it, however, using an 'if' clause to regulate it.
Collab Anyone?
By Lifeslayer, with no replies.
Hello! I was wondering if anyone wanted to start a collab with me! I was thinking of a platforming game but I am open for discuss. Please, drop a comment below or email me at tkoenig917@yahoo.com. I think this would provide more experience for me since I am pretty new and not very familiar with Java. Thanks for consideration:)
Can i call a variable int of a class from an other class? How?
By largowinch123, with 2 replies.
Last reply by largowinch123, about 12 years ago:
Your right!! Thank you very much! It was easier that i think it.
Playing a sound when the counter reaches the score of 10?
By DiplomatikCow, with 2 replies.
Last reply by davmac, about 12 years ago:
I want to make my game play a sound when the score reaches, ten, however, I have tried but have no clue how to do it. Help???
When you want to do something
when
some other condition is true, you use an 'if' statement: <Code Omitted> You need to replace the 'condition' and 'do_something' with suitable code. You need to put the "if" statement in your act method, or in some method that your act method calls, so that it continuously checks the condition.
Collision trouble
By M_Slofstra, with 1 reply.
Replied to by danpost, about 12 years ago:
Unless you publish the source code, it would be difficult to help with this issue.
637
638
639
640
641
642
643
X