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
problem with if loop (is loop right im german ?)
By jaki, with 5 replies.
Last reply by davmac, over 11 years ago:
yeah im german but what is right (if clause) ?
As
for
and
while
statements are examples of loops, an
if
statement is an example of
selection
. However the term isn't used much (and seems to have gone out of fashion, actually). People sometimes refer to them as
conditional statements
. If you're talking specifically about an "if" statement, it's probably best just to call it that: an
"if" statement
.
Issue learning Greenfoot
By Donte27, with 1 reply.
Replied to by davmac, over 11 years ago:
The "end of file while parsing" error normally means you've missed out on a '}' bracket. Your brackets must match up - there should be one '}' for every '{'. In this case it looks like you're missing the '}' at the end of the class.
Actor isn't working properly???
By ILOVELABRADORS, with 2 replies.
Last reply by ILOVELABRADORS, over 11 years ago:
Never mind I figured it out a minute after I started this discussion. OOPS! But thanks for your time!
Error: actor not in the world
By happy123, with 1 reply.
Replied to by danpost, over 11 years ago:
Both methods, 'touch' and 'touching' could possibly remove the actor from the world. If the first one called from the act method does remove it, you must not allow the second one to be called. You can either check if the actor is still in the world before calling the second one; or you can have the first one called return a boolean value indicating whether it was removed or not; or, you could combine the methods into a single method since the internal codes of both 'if' blocks are identical.
Drawing 300 stars in random locations
By spazonred1998, with 3 replies.
Last reply by davmac, over 11 years ago:
<Image Omitted> Use 'code' tags for your code, please. I was going to try and help, but it is too hard to copy/paste or refer to lines of your code.
how to use the mehod delay(int time) ?
By jaki, with 1 reply.
Replied to by jaki, over 11 years ago:
i solved it by my self xD how to rempve my post ?
how to use a world method in an actor class ?
By jaki, with 2 replies.
Last reply by jaki, over 11 years ago:
ty dude <3 it works but you forgot the () xD
Help with Transfer to next level
By BOBORING, with no replies.
i have a functional level 1 (Temple) in the game and transferring the character into the second level also works. The problem is my character wont move in the second level because the game crashes instantly. I believe its because the code for Player is always resetting something from Temple which shouldn't. Here is the code for the Player: <Code Omitted> This is the part of the transfer code. When add an "if" statement to check the level the Player is in (I might have done it wrong). I also have to transfer a counter as you can see above. Please help me its for very soon.
I need a timer.
By spider65, with no replies.
I need to figure out how to have a time limit for something to do something.
Checking if an object is removed
By AD99, with 4 replies.
Last reply by AD999, over 11 years ago:
Super_Hippo wrote...
Why do you store the locations in an array? When are the power ups spawning? In most breakout games, there is a chance for each removed block to spawn a power up.
Three power ups are spawned randomly underneath the blocks. I can make them spawn when they break I guess and set a limit to the power ups per level.
danpost wrote...
AD999 wrote...
Maybe I am over complicating things haha
Giving the blocks a removed state is not needed as you can check if it is not in the world with <Code Omitted>I really do not
I´m a beginner with Greenfoot please help me.
By Kieser, with 2 replies.
Last reply by danpost, over 11 years ago:
To be sure, the 'eat' method in the 'Animal' class needs a class, not an actor, as the parameter. Of note, the difference between the pairing of 'canSee' and 'eat' with the pairing of 'isTouching' and 'removeTouching' is that the touching methods acquire other objects whose images intersect any part of the image of the actor while the Animal class methods only acquire other objects whose images intersect the center-point of the image of the actor.
Creating Loop method for painting stars on World class
By SlaySlig, with 2 replies.
Last reply by AD999, over 11 years ago:
<Code Omitted> int i = 0 is the counter variable (while) i < 300 The statement will keep looping until i < 300 is false i++ increases the variable i by 1 every time the loop executes Simple explanation. Should read more tutorials and play around with the code to understand it better.
How do you make a health bar?
By spider65, with 5 replies.
Last reply by Zamoht, over 11 years ago:
Do you have a method to detect collision?
Need Help
By sllewis, with 1 reply.
Replied to by danpost, over 11 years ago:
The code you gave was this (repeated to show line numbers): <Code Omitted>Here is what I see: (a) you have two Strings, 'newImage' and 'newSound' declared as parameters; (b) you are setting 'Image' to one of the String parameters; (c) you are setting the image of the actor at line 4 (I presume this code to be in an Actor subclass) to a new image from 'image', which: - is not declared anywhere within the method; - is is p
How do I rename a world I already created?
By PikachuKirby, with 2 replies.
Last reply by PikachuKirby, over 11 years ago:
Thank you! It worked!
551
552
553
554
555
556
557
X