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
Error in Method Call. Why does space have to be infront of gameOver if the game over method is public
By Username45, with 1 reply.
Replied to by danpost, about 7 years ago:
Username45 wrote...
Error in Method Call. Why does space have to be infront of gameOver if the game over method is public
Because without it, "
this
" (the bullet, I presume, in your case), by default, is the object that the
gameOver
method would be executed on. But, the method is in your Space class and belongs to instances of the Space class. "public" just means you can call the method on an instance of the class from another class. From another class, you need to specify which instance of the class you are calling the method on, noting that you can create multiple inst
How do these numbers result in a specific color?
By QSABC10, with 2 replies.
Last reply by bentondecusin, about 7 years ago:
There are two ways to set colours. One way is what your font colour is using, which is <Code Omitted>Greenfoot provides several existed colours like Yellow, White, Red, Pink. You can find these colours on Greenfoot Documentation. Another ways is you make a colour. The method is <Code Omitted>or <Code Omitted>int a, int b, int c make up the RGB (red, green, blue) code and int d determines the transparency (0 is transpartent and 1 is opaque Hope this helps
What does it mean when the Brackets are surrounding the i? What does the do for the constructor class?
By Plop, with 1 reply.
Replied to by danpost, about 7 years ago:
What does it mean when the Brackets are surrounding the i? What does the do for the constructor class?
Please refer to
this page
of the Java tutorials.
why the red squiggly error
By divinity, with 1 reply.
Replied to by divinity, about 7 years ago:
hi pple i figure out the error
How Do You Remove an Actor?
By CosmicCaleb, with 5 replies.
Last reply by danpost, about 7 years ago:
For best help results, please show the current complete class and copy/paste the entire error output created from that code.
Hello. How do you do. I am newbie in greenfoot hehe. Oke i have question. How to shoot enemy where actor must get bullet first
By Dinarnur, with 1 reply.
Replied to by danpost, about 7 years ago:
Dinarnur wrote...
Hello. How do you do. I am newbie in greenfoot hehe. Oke i have question. How to shoot enemy where actor must get bullet first
Please help me
Too vague and general and lacking code. Please provide relevant class codes and point to what you tried where you are having issues.
how to manually feed an object
By SaveElephants, with 1 reply.
Replied to by danpost, about 7 years ago:
SaveElephants wrote...
I am trying to manually feed (add energy) my "friendly cat" to have him wake up. After 10 steps with out eating the pizza he falls asleep and you have to manually feed him to wake him up.
One possibility, maybe, is to use mouse clicks to manually feed the cat.
I keep getting an error in the findPizza method where it says "greenfoot.Actor cannot be converted to Pizza" << Code Omitted >>
It is not necessary to retain a reference to the intersecting pizza or to pass it to the eatPizza method. You could simply have:
How can I test if all specific actors have been removed from the world?
By EMatthee, with 5 replies.
Last reply by danpost, about 7 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, about 7 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, about 7 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, about 7 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, about 7 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, about 7 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, about 7 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, about 7 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
.
233
234
235
236
237
238
239
X