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
Transparency Issues
By SlothKing, with 11 replies.
Last reply by SlothKing, over 12 years ago:
Thank you so much dan!
Problems with angles and world edges
By welleid, with 5 replies.
Last reply by danpost, over 12 years ago:
For some really intense bounce coding, see the movement code of the Ball class in my
Pong Pinball
scenario.
Using getKey()
By SlothKing, with 5 replies.
Last reply by danpost, over 12 years ago:
Better might be to have one method called 'checkKeys' to replace 'checkJump' and 'checkShoot' as follows: <Code Omitted>
Joy of Code#17
By geekykid2013, with 4 replies.
Last reply by danpost, over 12 years ago:
If you use the auto-indent feature in the Greenfoot application, you can then look at the end of the class code and see if you have too many or too few brackets (you should have exactly one line at the end whose first character is a closing squiggly bracket).
Seaweed
By Frewt_Ninja2, with 5 replies.
Last reply by danpost, over 12 years ago:
Then, where I said '// do whatever', put <Code Omitted>You can change the speed of movement (4) to whatever (move(1) gives 4 possible directions; move(2) gives 16 possibles; move(3) gives 32; move(4) gives 40). Check out my
Radial Graphs Demo
using Radial movement and see the possible directions for each distance.
Control a sound that actually plays with the GreenfootSound method
By Solringolt, with 14 replies.
Last reply by danpost, over 12 years ago:
You forgot to include source code on your last posting of the scenario.
Accessing A Boolean From Another Class
By al_griff, with 3 replies.
Last reply by danpost, over 12 years ago:
The error message means you are trying to access a method or field that belongs to an object by using the class name of the object. As an example, let us say you have a class 'Apples' and a boolean 'hasWorm'; then you are trying to ask Apples.hasWorm which really does not make any sense. Any object of the class (any apple) may or may not have a worm, but asking if the class 'Apples' has a worm is not what you are trying to do. What you can do, since you are relying on an intersecting of the two actors is, in the class of the player, either in the 'act' method or a method it calls (assumin
Passing variables to other classes? possible?
By RobTheRipper, with 3 replies.
Last reply by danpost, over 12 years ago:
In your initial post, you mention 3 different actors. I will, from your secondary post, now assume that Actor Z and Actor Y are the same actor. Therefore: <Code Omitted>
help me!!
By 4yu, with 3 replies.
Last reply by azazeel, over 12 years ago:
better start with http://www.greenfoot.org/doc, you can find tutorial to get first step, video to easy way to understand but first of all, install the jdk, GreenFoot, and note that you cannot directly compile as ordinary java program, but run and compile it using GreenFoot and try this : http://www.youtube.com/watch?v=P6mu-GC194U&list=PL280AD6FCCFCDDAC5
Eating an object bug
By Gingervitis, with 18 replies.
Last reply by danpost, over 12 years ago:
My suggestion to you is to look over the
Trail: Learning the Java Language
. After checking that out, you should be in a much better position to tackle the project.
Need help with score counter and timer!
By cagrinsoni97, with 3 replies.
Last reply by danpost, over 12 years ago:
Lines 22 through 29 is the 'updateImage' method. It is called automatically anytime the caption or the value of the object changes. You just need to create and add the objects in your world class, setting field references to the objects so you can access them. Add these objects to the world in your world constructor. <Code Omitted>Then when the score changes (let us say goes up by five): score.add(5); Initially save a start time using System.currentTimeMillis() in a long field, and use the
Time taken for a project?
By Velociraptor06, with 2 replies.
Last reply by danpost, over 12 years ago:
I am sure that the answer would really depend on the type of project; the interactions involved between different actors; the intricacies and nuances of the project; how well the project is to be designed; the speed, accuracy and fluency of the coder; and a big factor may be how long it takes to resolve any problems encountered.
Class FPS?
By erdelf, with 1 reply.
Replied to by MatheMagician, over 12 years ago:
You can use System.currentTimeMillis(); to find how long each act cycle takes for the different actors. You must then take into account how many of each actor you have.
ai movement
By geekykid2013, with 2 replies.
Last reply by danpost, over 12 years ago:
What aspect(s) of it moving down is to be random? the speed? the turning? the direction? How random? what percentage of chance for each random aspect? What speed or range of speeds are these actors to fall (or move downward)? What code have you tried? How is it not doing what you want? Anytime you start a discussion dealing with programming, details like these are important. Without them, we are more lost than you.
My actor only moves on the X and Y axes and their diagonals?
By RobTheRipper, with 8 replies.
Last reply by danpost, over 12 years ago:
Turning towards the objective every act cycle will help keep you in line, but not ensure that you will not pass up the objective if and when you do reach it. Using the Math.atan2 function is only another way to come up with the angle to turn toward and will not work any better. Better might be to keep track of the line between the original location and the target. Dividing this distance by the move amount will give us an approximate number of cycles needed to reach the target. If we divide the difference in the x-values and the difference in the y-values by this amount will give us the rea
867
868
869
870
871
872
873
X