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
getObjectsInRange help?
By PiercingGoblin, with 1 reply.
Replied to by Builderboy2005, almost 13 years ago:
The command getObjectsInRange() returns a List object that is never null, but might have a size of zero. Therefore, instead of checking to see if the list is null, you should check to see if it has a size of zero, using the .size() method :)
Anybody know the code to theses certain circumstances?
By DAustin15, with 1 reply.
Replied to by danpost, almost 13 years ago:
Check out one of my Snake Demo scenarios. It has code for 4-way movement (up, down, left, and right). The only difference being that the Snake is user-controlled (by the arrow keys), and your scenario will just increment the direction value (direction = (direction + 1) % 4; when it reaches the edges). Get all individual parts of the game working first, then work on combining them into a complete game.
scale
By tylers, with 1 reply.
Replied to by danpost, almost 13 years ago:
Each time the act method is called, you end up scaling a scaled image. The result in doing this is what you see happening. What you need to do, is create a
new
GreenfootImage by using one of its constructors (probably the one that uses the filename, since you made it in gimp), and scale that new image directly to the required size.
World Movement
By thefutureisnow, with 6 replies.
Last reply by Builderboy2005, almost 13 years ago:
As long as you make your Greenfoot world an open world (it's an option in the constructor) objects will be able to move anywhere (including off the screen) without a problem.
Scrolling
By badboy201199, with no replies.
how do you make the world scroll across as the character moves across i know it sorta does it automatically but most of the time the character escapes the picture
Is there a contrary from this code
By martijn13039, with 62 replies.
Last reply by martijn13039, almost 13 years ago:
oke give me a few time so I can make it and post it
How do I store a variable to a text file
By TechWebLock, with 1 reply.
Replied to by trash1000, almost 13 years ago:
Why don't you retrieve all the scores and save them back into instance variables when you start the game. Now a level ends and you check for the score to be higher than the one you just retrieved. If so you change the score and write it back into the file. Like you retrieve the scores into 3 instance variables - score1, score2 and score3 for example. Now the player beats level 1 - you check his score to be higher than score1, if so you set score1 to the player's score and write it to the file (the other levels go accordingly). Here are a few methods with which you can easily write variables
Picking Up Objects
By Denzien, with 6 replies.
Last reply by danpost, almost 13 years ago:
@kartikitrak, it appears you want code in the Coin class, for a coin to look for an intersecting coin; which, of course, is not what is wanted. In the class of the actor that is to collect the item, add the following method: <Code Omitted>and call it from the act method with (example is for coins): <Code Omitted>
Platforms which move up and down?
By dandefender2, with 1 reply.
Replied to by trash1000, almost 13 years ago:
Well, you have to decide when you want the platform to move up again. I'd say the easiest way is to use a boolean variable - if it's true you move down, if it's false you move up. <Code Omitted>This will cause the actor to constantly move up and down from the top world edge to the bo
<Identifier> expected
By fred, with 2 replies.
Last reply by fred, almost 13 years ago:
Thank you :)
Re-entering levels at different x,ys.
By dlanni, with 4 replies.
Last reply by dlanni, almost 13 years ago:
Yay! Lana now leaves Level2 Bedroom correctly !! I put all the code from this string and the other in. A few new problems: 1. Lana can't get out the front door at all. When she gets close to it ( probably y<100 ) she is flung back to beginning position (approx x=100, y=450.) 2. When this happens the front door closes!? 3. When she enters the Level 3 bedroom she can't get out ( well, probably she could get out by continuing left down the x axis and end up as if she just came from Level2) So I think that I need to add m
Greenfoot.isKeyDown()
By darkmist255, with 9 replies.
Last reply by darkmist255, almost 13 years ago:
Thanks, I had a feeling that Java just didn't like the numpad. I'll avoid these keys in the future.
How do I change the default world?
By darkmist255, with 2 replies.
Last reply by darkmist255, almost 13 years ago:
Ah, thanks!
Zooming in and out
By mcwell, with 4 replies.
Last reply by mcwell, almost 13 years ago:
I'll give that a try Builderboy. Thanks for the help guys
Reliably playing sound in Greenfoot
By triss, with 5 replies.
Last reply by davmac, almost 13 years ago:
On Mac OS X, the Java version is essentially fixed - it's updated along with other OS components, so it's generally difficult to get into a situation where you have a really old Java version; in any case, though previous Java-for-mac versions have had "issues" with sound, they've generally not had the problems described above. (Also, Java 7 isn't available for OS X 10.6).
968
969
970
971
972
973
974
X