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
&& operator with strings?
By darkmist255, with 8 replies.
Last reply by AwesomeNameGuy, over 13 years ago:
I think that == seems to work sometimes because Java handles strings a little differently than most objects, it has something called a "String Literal Pool" where it has all the strings that are coded into your program already sitting there in memory, or something like that, and it is optimized to use as few strings as possible, so if you have literal strings in your code, and you reference them, a lot of the time you will be referencing the same string anyway and == works. But other times it won't work. Just remeber the difference between references, primitives, and objects. == compares refer
java.lang.NullPointerException
By darkmist255, with 4 replies.
Last reply by darkmist255, over 13 years ago:
Thanks! And I would say that doing "if (someVariable != null)" could help with many methods that can return null?
How to use fillOval?
By rgadue, with 9 replies.
Last reply by keiko1dog, over 13 years ago:
Thank you so much for the explanations!!!!! they helped me understand and figure it out!!! Thanks again AwesomeNameGuy and DanPost!! I really appreciate your help!
What's Wrong?I want the GreenfootImage Class
By Upupzealot, with 6 replies.
Last reply by davmac, over 13 years ago:
Upupzealot: What code did you try, and what error message did you get?
Compiler Warning (continued)
By sjaaksm, with 2 replies.
Last reply by sjaaksm, over 13 years ago:
I know which method causes the warning, and indeed, it has to do with generics. But whether or not the warning will pop-up seems to depend on the jdk that is used Btw, the link to the Ausgangsszenario is: http://greenroom.greenfoot.org/resources/51 It would be nice if the code could be adjusted in such a way that the warning is not given anymore. Sjaak
What happens if I become good at Greenfoot?
By Comrade, with 2 replies.
Last reply by mjrb4, over 13 years ago:
The language you're using in Greenfoot is plain old Java - you can use any Java libraries you like, code just as you would in real world Java - the conventions are the same, the syntax is the same, the language is the same. In short, pretty much all the concepts you learn in Greenfoot can be applied to "real world" situations, Java or not - and if you develop using Java (which is a highly used language in the real world, Google uses it extensively for instance) they'll translate directly. Greenfoot does make things easy from a graphical perspective and there are of course additional conc
Acts per second? Displaying numbers on-screen?
By Royalblue64, with 25 replies.
Last reply by kiarocks, over 13 years ago:
the s is the string for the image, the 12 is font size,the next thing is text color, the last thing is background.
accesing variables in another class
By styxtwo, with 2 replies.
Last reply by styxtwo, over 13 years ago:
Thanks for your reply, it is very helpful :).
why is Greenfoot being called "Greenfoot"?
By winnerpig, with 7 replies.
Last reply by winnerpig, over 13 years ago:
"BlueJ","Greenfoot" and "Redhat" seems to be the three sisters of a family ! haha~
Public Variables, we meet again
By darkmist255, with 18 replies.
Last reply by darkmist255, over 13 years ago:
Huzzah! Fixed it! It was as simple as this: It said it didn't like me accessing the non-static variable, so I changed this <Code Omitted>to this <Code Omitted> and what do you know, it worked :D.
Incompatible types
By darkmist255, with 4 replies.
Last reply by darkmist255, over 13 years ago:
Thanks :D.
Collision Sensing
By Steve_888, with 1 reply.
Replied to by mjrb4, over 13 years ago:
You probably want to look at the
getObjectsInRange
method which will allow you to get a list of all the objects a certain radius (or closer) away from the actor.
just looking for a little help
By ub3030, with 7 replies.
Last reply by mjrb4, over 13 years ago:
Well if it has objects in the way that makes it a bit more complicated. You could keep track of your position by judging how much you've turned / travelled then work out from that if something you've hit is a likely edge or obstacle. That might give you a starting point. With these sorts of problems it's often easier to map out your logic on paper first, then turn it into code later.
How to make the view like in Szenario "City" ??
By TopInPut, with 5 replies.
Last reply by mjrb4, over 13 years ago:
The short answer is likely if you have to ask the question, then you're probably not at a stage where you can implement it. It is indeed impressive and a nice piece of coding, but any 3D or iso-3D like worlds you see in Greenfoot have had the 3D in them coded by hand, it's not something that's built into Greenfoot at all! Of course, this doesn't mean you can't look at the source code, try to gain an understanding of it and learn from it :)
Cannot return a value from method whose result type is void
By darkmist255, with 1 reply.
Replied to by darkmist255, over 13 years ago:
I changed it to double and it no longer has an error, disregard this :D.
1028
1029
1030
1031
1032
1033
1034
X