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
How can I test if all specific actors have been removed from the world?
By EMatthee, with 5 replies.
Last reply by danpost, almost 8 years ago:
EMatthee wrote...
Please help? I don't know how to do that. Can you please give me the code?
Example use of
ask
: <Code Omitted>
What is the meaning of the variable "i"?
By What?, with 1 reply.
Replied to by danpost, almost 8 years ago:
What? wrote...
What is the meaning of the variable "i"?
It is just a new variable used to control how many times the loop is executed -- a loop-counter.
Is there a way to wait before each while iteration?
By benig, with 1 reply.
Replied to by danpost, almost 8 years ago:
benig wrote...
Is there a way to wait before each while iteration? For example, wait for a few microseconds?
Add: <Code Omitted>within the
while
loop. That should be good for around 20 milliseconds.
What does synchronized mean in this code?
By Dallas123, with 1 reply.
Replied to by danpost, almost 8 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, almost 8 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, almost 8 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, almost 8 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, almost 8 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, almost 8 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, almost 8 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, almost 8 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, almost 8 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, almost 8 years ago:
get flamed bro!
fat cat project - need help writing if statement
By Toodumbtocode, with 1 reply.
Replied to by danpost, almost 8 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, almost 8 years ago:
Thank you so much!
235
236
237
238
239
240
241
X