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
Returning values
By Rod53, with 1 reply.
Replied to by danpost, almost 7 years ago:
You can only return one thing back to the calling method. If you require more than one
int
value to be returned, it must be wrapped in another object. For 2
int
values, you could return a
Point
object that holds two
int
s: <Code Omitted>or more simply an array: <Code Omitted>Just change the return type of the method from '
int
' to '
Point
" or '
int
' followed by empty square
maze
By BlueberryGaming, with 3 replies.
Last reply by danpost, almost 7 years ago:
BlueberryGaming wrote...
i want it to swap worlds like if i finish world one and i reach end point it changes to world 2 or i am on finale level it ends game i am new to code
As you have basically said -- in pseudo-code: <Code Omitted>
Keep getting null pointer exception
By Will5230, with 5 replies.
Last reply by Will5230, almost 7 years ago:
Thanks a lot!!
Animations
By Legitimacy, with 3 replies.
Last reply by danpost, almost 7 years ago:
Nahquin wrote...
<< Code Omitted >> Try this
Best would be to put the image set, or their numbers, in an array and use a factor of the act counter to get the index of the current image: <Code Omitted>
Splitting up objects?
By CharBun, with 1 reply.
Replied to by danpost, almost 7 years ago:
CharBun wrote...
if the planet size becomes over 25, it splits into tinier planets who go their own way. I tried modifying the code from the astroids (where the asteroids go half the size if they get hit by a bullet) but I got completely lost.
Just create two new Body objects, add them into the world at the over-sized body's location, set their vectors to that of the over-sized body and maybe turn them a bit in opposite directions; then remove the over-sized one. Well, it should be as simple as that, except for the fact that you cannot currently get the direction of a body -- you can
How to turn towards actor?
By 343qwm29, with 2 replies.
Last reply by 343qwm29, almost 7 years ago:
Thank you for your help, and there is only one dancing queen so this works.
How to change hitbox (?)
By darkangel998, with 3 replies.
Last reply by danpost, almost 7 years ago:
darkangel998 wrote...
<< Code Omitted >>
Cool -- I like the mix of blue and green in the user icon. I tested the code given and the hit box seems to coincide with the size of the actor as it grows.
Project Freezes
By Anonymous1313169, with no replies.
I finished one of my projects a few days ago and found out that when I export it to a JAR file, it freezes after about an hour of running. This problem does not appear on normal Greenfoot, just on the JAR file. I tried every technique I could think of, but it still freezes.
how to make power ups
By Mustafa405, with 6 replies.
Last reply by Mustafa405, almost 7 years ago:
i have a question if i use the isTouching method once i move from the object will the actor return to normal or will it stay as the new actor edit:nevermind
How do you define WorldEdge? How do I make objects disappear under defined circimstances?
By Blyat, with 1 reply.
Replied to by danpost, almost 7 years ago:
There is no method with that name listed in the
Actor class documentation
. The method you want is there, however.
How to read multiple tokens in scanner input?
By Zweeg, with 1 reply.
Replied to by danpost, almost 7 years ago:
I am guessing you want to combine the genre with the description. Please confirm. Also, show the code lines used to create this Scanner object.
Unable to find Method?
By Legitimacy, with 17 replies.
Last reply by danpost, almost 7 years ago:
Legitimacy wrote...
I reinstalled Greenfoot and it still didn't work. I also installed Greenfoot on my laptop and tried to open the project on that and it didn't work either. I tried opening a previous version of the program which was working perfectly and it has the same issue. I also tried copy and pasting all the code from what I pasted into my previous message and it did not work. Any ideas?
Sorry, ideas are not fresh, at this point.
I am Making a snake game and cant get the code to work in my snakehaed, snakebody or snake world classes.
By zach0531, with 2 replies.
Last reply by danpost, almost 7 years ago:
Try removing <Code Omitted>from all your classes and add a Point class to the project: <Code Omitted>
Increase cost and add for counter.
By MemThef, with 1 reply.
Replied to by danpost, almost 7 years ago:
Maybe you should have a purchase price field in the Arrow class and add a parameter to the Arrow constructor to pass the value to it. That way. each arrow will be able to calculate how much to add to the counter (based on its cost).
Gravity doesn't work
By CoolSharkCody, with 19 replies.
Last reply by CoolSharkCody, almost 7 years ago:
It worked. Thanks!
223
224
225
226
227
228
229
X