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
If statements aren't working in Greenfoot
By student101, with 10 replies.
Last reply by student101, about 12 years ago:
Nevermind, I managed to solve the problem on my own!
Level changing issues :(
By Draymothisk, with 1 reply.
Replied to by danpost, about 12 years ago:
If you had increase/decrease/set methods, then you can use the 'set' methods for stats (Health, score, and lives) to 'pass' the information to the new world. For example, just to show the idea: <Code Omitted>
Need help, I´m a noob at Greenfoot :(
By herzi789, with 5 replies.
Last reply by Draymothisk, about 12 years ago:
You could check your dog's x or y position and move according to that. The code would be simple. Assuming your world's size is 600 pixels wide, you can tell your dog the following. If your X position is greater than or equal to 590 (10 pixels less than your world's total width), move left (a negative number). If your X position is less than or equal to 10 (10 pixels more than your world's minimum width), move right (a positive number). The following code is exactly what is written here, except I created a variable named speed to hold our positive/negative number. With just this code, yo
Walls
By Gingervitis, with 4 replies.
Last reply by Draymothisk, about 12 years ago:
For a simple, beginners way of doing hit detection, try this. Actor Wall; Wall = getOneIntersectingObject(Wall.class); if(Wall != null) { //Wall is being hit. Do things here. moveRight = 0; //stop character from moving right or whatever. } else { //Wall is not being hit } Change "Wall.class" to whatever your wall class is named. The rest of "Wall", such as the first after "Actor", can be named what ever you want.
add a new line depending on the amount of character (or words)
By tylers, with 6 replies.
Last reply by tylers, about 12 years ago:
yes, thanks :D how could i add that to my code ( how could i use it)
dont matter
Actor is going through wall on the left side.
By Qslick, with 3 replies.
Last reply by Qslick, about 12 years ago:
Thanks It WORKS!!!!!
How Greenfoot where to find pictures?
By Qslick, with 5 replies.
Last reply by Qslick, about 12 years ago:
Never Mind I figured it out. Thanks so much for your help
Audio length?
By nooby123, with 7 replies.
Last reply by danpost, about 12 years ago:
What you need is a status bar that displays the value of one hundred times the amount of time played so far divided by the total amount of time to play the whole audio; this calculation will produce a percentage (using values of 0 at the start through to one hundred at the end). You could create your own; or there are various support classes on-site that supply status/health/counter/timer/progress. In fact, click on my icon, and I believe that under 'Some scenario by danpost' you will find my 'Progress Bar/Health Bar Support Class'. I have another scenario that has several sub-classes that
One Random Number
By SunnyD212, with 1 reply.
Replied to by danpost, about 12 years ago:
You probably just need to qualify (add a condition to regulate) showing of a new number by asking if a number is already there or not. In pseudo-code: "If no goalNumber object is in the world, add a new goalNumber object to the world." With this, all you have to do is, when you are done with one, remove that goalNumber object from the world.
a soother setLocation()
By tylers, with 1 reply.
Replied to by Gevater_Tod4711, about 12 years ago:
You could use double value for speed to make it more smooth. You just have to cast it to an integer if you want to use it in the setLocation method.
getObjectsInRange or maths problem
By seelensauger, with 1 reply.
Replied to by seelensauger, about 12 years ago:
hmm the problem is gone... I haven't changed anything... ;) i hope it won't come again ;)
how to remove all objects in the world
By nooby123, with 8 replies.
Last reply by danpost, about 12 years ago:
@mik, thanks michael -- I knew one of the two would work, so I gave both with the 'or'. Though, it makes sense that it would be the one it is. It still would create a List object, even if it is empty. It also makes sense that 'removeObjects(List)' would work on an empty list. Thanks, again.
Help with collission
By FergisonSan, with 4 replies.
Last reply by Gevater_Tod4711, about 12 years ago:
You could try to use getObjectsInRange(); Then the actors might change their direction before they crash. Change line 4 of the code I postet before to this: <Code Omitted>
Placing Random Orbs
By CHERNANDEZ95, with 2 replies.
Last reply by CHERNANDEZ95, about 12 years ago:
Thank you for the information. I will definitely be using it.
Collission
By FergisonSan, with 1 reply.
Replied to by Gevater_Tod4711, about 12 years ago:
Why do you have the same question two times? I just answered it
here
.
880
881
882
883
884
885
886
X