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
JPanel in GreenfootWorld?
By erdelf, with 5 replies.
Last reply by Upupzealot, over 13 years ago:
I looked into Greenfoot's source code. As @nccb said, the world is based on a JFrame. But, it use different classes when it run as a JAR file or in the Greenfoot program. For Jar packages, it's based on a class GreenfootScenarioViewer which extends from JApplet. When it runs in the Greenfoot program, it's based on a class called GreenfootFrame which extends from JFrame. I think it will help, if you look into Greenfoot's source
greenfoot.exe connects to 239.255.255.250:1900?
By erdelf, with 4 replies.
Last reply by erdelf, over 13 years ago:
thx
Using font based on image
By SPower, with 1 reply.
Replied to by nccb, over 13 years ago:
The hard way! (That is, index into the image and pick out letters as needed by copying them across.) Don't forget to fall back to some other font for characters outside that range (unless you know
for definite
that you'll only see the basic ASCII characters).
Stopping a sound when world changes
By gusbus123, with 30 replies.
Last reply by gusbus123, over 13 years ago:
ok
Help with Dog Scenario
By Wendyb, with 7 replies.
Last reply by danpost, over 13 years ago:
@steved, If the dog in question is to be player-controlled, a reference to that dog would be helpful. In fact, the declaration of <Code Omitted> should probably be in with the world instance fields (that is, declared outside any methods; but still within the class code) with <Code Omitted> in the constructor. As an alternative <Code Omitted>could be declared and in the constructor<Code Omitted>but, I prefer the former way for objects that are to be in the world at start-up.
java.lang.OutOfMemoryError: Java heap space
By sparrow72, with 7 replies.
Last reply by danpost, over 13 years ago:
When you delete all objects of a class, you are also deleting all objects that are sub-classes of that class. Since Level1 extends Levels, Level1 is an instance of Levels, but more specifically, an instance of Level1. I have never tried anything like this, but maybe you can use a List method to remove 'this' within the parameter?
how to jump
By Benedict, with 4 replies.
Last reply by danpost, over 13 years ago:
@Jinice, Instead of lines 3 and 4 in the trampoline code above, use: <Code Omitted>The boolean field 'onGround' should be declared as an instance variable in your character class, initially set to 'true'. Change to value to 'false' in the code block for the 'if' statement. When a 'landing' is detected, change it back to 'true'. Things to be aware of: detecting the landing could be a bit tricky; if your character is falling fast and the object to land on is not very thick (height-wise), the character could just pass it up or get stuck inside of
help with subclass referencing and 'cannot find symbol - ...' errors
By sparrow72, with 6 replies.
Last reply by davmac, over 13 years ago:
To specify a class as a parameter, you can use a
class literal
, which ends with ".class". So, in this case it should be: <Code Omitted>
Execution just... skipping
By darkmist255, with 9 replies.
Last reply by SPower, over 13 years ago:
For some extra information, those stop signs are called breakpoints.
Using 'lists'
By Gazzzah, with 7 replies.
Last reply by danpost, over 13 years ago:
Well, I took some time looking through the APIs, and came up empty. That is, until I remembered an in-house project I had done for someone that required some directory searching; so, I located the project and reviewed the source. I almost gave up on that idea when I saw the JFileChooser, FileNameExtensionFilter, and JFrame import statements (nothing refering directly to Files themselves), but decided to look deeper in the code. I found a reference to the File class within the code and reviewed the imports, again. Then, I saw it:
import java.io.*;
. That had to be it! I went back to
Help Me Please!!!
By benedict3578, with 8 replies.
Last reply by danpost, over 13 years ago:
@SPower Actually, and unfortunately, your 'mistake' is worse than benedict3578's. His could only mean what you corrected his to say, as the Actor class is already named 'Actor' and cannot be renamed. Yours, on the other hand, has other possibilities which do not fit the case. Let's not nittpick semantics, at least in those cases where it is obvious what is being said. :)
Error within Terminal Window
By Marie, with 4 replies.
Last reply by SPower, over 13 years ago:
The course is posted! Sorry for the time it took, I was busy with some other things. Look at this scenario:
http://www.greenfoot.org/scenarios/5709
Exception with sound file
By SPower, with 3 replies.
Last reply by SPower, over 13 years ago:
Thanks, I'll look at it.
getNeighbors
By fishwaffles1337, with 5 replies.
Last reply by fishwaffles1337, over 13 years ago:
I've published the game feel to look at it and give any suggestions, it's obviously still a work in progress.
http://www.greenfoot.org/scenarios/5708
Finding the length of a list.
By fishwaffles1337, with 3 replies.
Last reply by danpost, over 13 years ago:
The problem is that line 32 creates a new variable called neighbors, and does not assign the list to the class field called neighbors. Therefore, line 41 will always return 'false', because the size of the class field is never populated. Easy fix, change line 32 to: <Code Omitted>By not declaring the variable here (no casting of type), the class field will be used. Also, by specifying 'Cell.class' as the class to list, only neighboring cells will be listed. One more thing, I am not sure why you asked if the size was greater than one. I have a
951
952
953
954
955
956
957
X