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
What does synchronized mean in this code?
By Dallas123, with 1 reply.
Replied to by danpost, over 6 years ago:
Dallas123 wrote...
What does synchronized mean in this code?
I am not really sure that synchronized needed to be used here in the Explosion class. When a method is declared to be synchronized, two or more different threads cannot simultaneously execute the method. One would be forced to wait until another has finished its execution of it. This is, however, most probably beyond the scope of what you should be concerned with at this point.
What do the brackets do when surrounding the i in the code?
By Plop, with 1 reply.
Replied to by danpost, over 6 years ago:
Plop wrote...
What do the brackets do when surrounding the i in the code?
The images field is declared to hold an array of GreenfootImage objects. Line 6 creates an array of length IMAGE_COUNT and assigns it to the field. The for loop says to count up to that number of images (the count, held in 'i' will be used to point to a particular image in the array, as an index). When you see square brackets like that in any java code, then an array is being dealt with.
What does "final" mean
By bentondecusin, with 1 reply.
Replied to by danpost, over 6 years ago:
bentondecusin wrote...
<Code Omitted>
The final keyword is used to indicate that the value or object assignment is not allowed to change. The assigned value is a constant or the object is permanently assigned. If an attempt is made to make a re-assignment, a compilation error will ensue.
What does the code below do?
By zog, with 1 reply.
Replied to by danpost, over 6 years ago:
zog wrote...
What does the code below do? << Code Omitted >>
It take a vector (a direction and a magnitude, "length"), and converts it to the distances they make along the x and y axes to get to the same end-point.
Can I put a value in the parentheses of bullet.move();?
By Borf, with 8 replies.
Last reply by danpost, over 6 years ago:
Borf wrote...
Can I put a value in the parentheses of bullet.move();?
The
move
method of the
Actor
class
requires
an
int
value in the parentheses. See
here
.
Is there a way to change font styles in Greenfoot?
By patches312, with 1 reply.
Replied to by danpost, over 6 years ago:
patches312 wrote...
Is there a way to change font styles in Greenfoot?
If you mean to change to bold or italicized, you can create a new Font with those characteristics. Without testing, I think you could change line 10 to something like: <Code Omitted>
What does the value<target string mean?
By BH54, with 1 reply.
Replied to by danpost, over 6 years ago:
BH54 wrote...
What does the value<target string mean? << Code Omitted >>
This particular Counter class has an animated score display. If, let us say, 5 points was to be added to the score, the true score is set as a target for which the value of the counter (which is displayed) is to more slowly progress to. So, if the value of the counter was zero (as is the value of target), when 5 is added, target is set to 5 and the displayed value will be seen to be "rolling" up to the new "target" value. The act method basically says to change the shown value by one toward the target value if
Why am I getting an error in my for-loop in my createStars method?
By dmac28, with 2 replies.
Last reply by danpost, over 6 years ago:
dmac28 wrote...
We are having a quiz this week and I am not sure why I am having errors in the parameter of my method. If anyone could help me, I would appreciate it.
The error is in the previous line (line 3). It just "runs" into the next line because the compiler is trying to make sense of line 3 (which is not a completed line of code).
Why are you adding asteroids into the world in a method that is to create stars?
What is the smallest delay I can put between the reload delay?
By BucketSqaudGodSquadNationGangGangPraiseJesusLoveMom, with 2 replies.
Last reply by danpost, over 6 years ago:
BucketSqaudGodSquadNationGangGangPraiseJesusLoveMom wrote...
What is the smallest delay I can put between the reload delay? << Code Omitted >>
To determine the smallest delay (without having no delay), one would need to see how you are running the counter and when it is incremented with respect to when you check its value and reset its value during an act cycle.
What does the super before (velocity) do?
By irishman, with 1 reply.
Replied to by iamdsd, over 6 years ago:
get flamed bro!
fat cat project - need help writing if statement
By Toodumbtocode, with 1 reply.
Replied to by danpost, over 6 years ago:
Toodumbtocode wrote...
I'm very new to greenfoot but i don't know whats wrong with my if statement!! please help << Code Omitted >>
A class can create multiple same-type object and each will have their own state. That is to say, which
Cat
instance are you trying to determine is tired? Cat, being the name of a class, does not answer this. You need to get the state of an object of the class, not the class itself.
Need help adding black keys for the piano project....
By Toodumbtocode, with 10 replies.
Last reply by Toodumbtocode, over 6 years ago:
Thank you so much!
Help with Fonts
By Chipley, with 1 reply.
Replied to by nccb, over 6 years ago:
In more recent versions of Greenfoot, we no longer use java.awt.Font and instead have our own greenfoot.Font class. Remove the line near the top that says "import java.awt.Font". Then change line 22 in the snippet to be new Font("Comic Sans MS", 32) without the Font.PLAIN part. That should get the code working.
downloading Greenfoot
By meriem, with 1 reply.
Replied to by davmac, over 6 years ago:
Hi! The first rule of asking for help is "give details" :) Without knowing what you've tried and what happened when you did, no-one can help. The best I can say is that you can download Greenfoot from the "download" section of this website, and the installation instructions are linked from there as well.
Basic Button
By Gaming_100, with 5 replies.
Last reply by danpost, over 6 years ago:
Gaming_100 wrote...
So what should my code look like?
Just move (cut and paste) lines 10 through 13 into an
act
method within the class.
233
234
235
236
237
238
239
X