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
addObject method not working and I don't know why?
By potatosnix, with 2 replies.
Last reply by potatosnix, over 6 years ago:
danpost wrote...
potatosnix wrote...
I'm trying to add an object but the addObject method isn't working for some reason, not sure what I've done to accomplish that << Code Omitted >>
The
addObject
method is not an
Actor
class method.
Thank you, I didn't even think of that! All fixed and working, thank you so much!!
What is the meaning of prefix?
By MB12345, with 1 reply.
Replied to by danpost, over 6 years ago:
MB12345 wrote...
What is the meaning of prefix? << Code Omitted >>
prefix
is the label you wish to give to the value the counter is to display. Some possible examples "Score: ", "Worms Eaten: ", "Level ", "Time remaining: " etc. The prefix is displayed, as a label, in front of the value.
What does this code do?
By iamdsd, with 1 reply.
Replied to by danpost, over 6 years ago:
iamdsd wrote...
What does this code do? << Code Omitted >>
It appears to animate an actor in such a way as to go forward in some way (maybe change or grow or progress and then go backward (maybe revert or shrink or regress). This action is done one time and the actor is them removed from the world. Lines 3 and 5 iterate through the images in the array. The first
if
block reverses the direction that the images in the array are being used. The second
if
block removes the actor after the last image going in reverse is used. To make more clear, the code could be used
Is there any way to spawn ememies at an interval?
By CharBun, with 5 replies.
Last reply by danpost, over 6 years ago:
CharBun wrote...
<< Code Omitted >> I have this right but it doesn't work?
Lines 10 and 11 should go in a constructor and line 9 should go in the
newWave
method. Remove lines 9 through 11 and add/edit the following blocks of code: <Code Omitted>
I get an error message every time the rocket hits an asteroid. Does anybody know what the problem is?
By Cheerioman25, with 1 reply.
Replied to by danpost, over 6 years ago:
Cheerioman25 wrote...
I get an error message every time the rocket hits an asteroid. Does anybody know what the problem is?
The actor loses its location in the world when you remove it from the world. Add the explosion before removing the actor from the world.
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, over 6 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, over 6 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, over 6 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, over 6 years ago:
hi pple i figure out the error
How Do You Remove an Actor?
By CosmicCaleb, with 5 replies.
Last reply by danpost, over 6 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, over 6 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, over 6 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, over 6 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, over 6 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, over 6 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.
232
233
234
235
236
237
238
X