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
Actor goes through moving platforms
By beshie, with 1 reply.
Replied to by danpost, over 9 years ago:
Code the behavior of each actor in their own class. HINT: it is the behavior of the Ice objects to move anything on them with it. Therefore, Bailey will have its own movement, coded in its own class, plus the movement provided by the Ice object it may be on, coded in the Ice class.
How long are the numbers in Greenfoot.delay();?
By OKNEM, with 2 replies.
Last reply by OKNEM, over 9 years ago:
Awesome. Thanks.
How do I fix this Error message?
By Tuckerbm, with 2 replies.
Last reply by danpost, over 9 years ago:
A class is capable of creating multiple objects of the same type and therefore 'Space' is not specific enough to indicate which world will execute 'Loselife'. Using 'getWorld' will return the correct World object to execute the method on; however that is still not enough because it does not specifically return a Space object which is necessary to execute the method located in that class. We must inform the system that it is indeed a Space object through typecasting: <Code Omitted>
I keep getting an Error saying Shiny cannot be cast to Seagull
By Junyi, with 1 reply.
Replied to by Nosson1459, over 9 years ago:
If you want to check for a collision with Shiny class then do: <Code Omitted>
Change Image
By Fatum, with 1 reply.
Replied to by Nosson1459, over 9 years ago:
In your act method just do: <Code Omitted>The for loop will make the variable 'num' be equal to 32 so the image will always be "Wall1.png".
Fatum wrote...
<Code Omitted>
So basically if isTouching(Lazer.class) or not (else) num will be equal to 32. The for loop doesn't make sense because you're setting num = i but there is no other code being
What does this mean?
By JokeNotFound, with 3 replies.
Last reply by Nosson1459, over 9 years ago:
The '%' is the remainder operator. It returns the remainder of the two dividends instead of returning a double (decimal number). So 100 / 55 = 1818181818... (1 + 9/11), but 100 % 55 = 45. So if you do == 0 afterwards that means that there is no remainder meaning that the number is a multiple of 55. The code above will show a 1 when time == 55 and a 2 when time == 110 and so on.
Lifebar in Greenfoot
By elroxar, with 2 replies.
Last reply by Nosson1459, over 9 years ago:
You will only get either 1 or 0 bars since in each case in the switch statement there is only 1 addObject.
Super_Hippo wrote...
Do not create an own class for every life bar. Add a new instance of life bar for every character into the world once when the game starts. When a character loses a life, tell its life bar to change its image accordingly to the lives left.
Points counter?
By OKNEM, with 31 replies.
Last reply by OKNEM, over 9 years ago:
Thank you so much! I got it! Sorry for the really long conversation, but it was worth it! Thanks heaps! :)
how to create the play button on the screen?
By Ajis, with 1 reply.
Replied to by danpost, over 9 years ago:
A button is just an Actor object with one or more possible images that clicks are detected on. I consider a button to be a simple Actor object, meaning no state or implementation need be added into its class. You could simply have this class, which is the entire class: <Code Omitted>Then, create an object from the class, give it an image and test for clicks on it:
NullPointerException error?
By MrMeme, with 1 reply.
Replied to by danpost, over 9 years ago:
The Score object reference field, 'score', in your Enemy1 class is never assigned a Score object and nowhere in the codes given do I see 'new Score()'.
help with my score board
By greenfoothighschooler, with 1 reply.
Replied to by danpost, over 9 years ago:
greenfoothighschooler wrote...
I've already added a scoreboard, and when I click on the voidaddScore() on the counter it adds one point. How do I make it add a point when my laser kills (comes in contact with) an alien, and not when i click voidaddScore() ??
The alien or the laser (whichever is performing the collision detection between the two objects) needs to obtain a reference to the counter object. Usually with something like this (if only one counter object is in the world): <Code Omitted>
how to image manipulate http://www.greenfoot.org/topics#
By Darklord033, with 1 reply.
Replied to by danpost, over 9 years ago:
Darklordd033 wrote...
how to image manipulate http://www.greenfoot.org/topics#
Give a specific example of what you want to do. The topic is too broad to be answered fully here.
how do you change the color of an object in greenfoot?
By queena, with 1 reply.
Replied to by danpost, over 9 years ago:
queena wrote...
how do change the color of an object in greenfoot?
What are you using for images? Are you creating them programmatically -- or do you have different images of the same object in different colors?
How do I create an inventory?
By SallySanban, with 55 replies.
Last reply by danpost, over 9 years ago:
Okay, remove that line I had you put in after line 50 and add the following line at line 81 (using the line numbers of the full class code above): <Code Omitted>
updating texts
By Tyronmi, with 1 reply.
Replied to by Super_Hippo, over 9 years ago:
You can save up to 5 Strings with each up to 50 characters (for each user) with the UserInfo class provided by Greenfoot. It saves them into a .csv file and can get the data from it. You can obviously doing the same with writing the text into a .txt file, but this is not as easy as with the UserInfo class. There are some examples here on the site how to write to a .txt file I doubt that Droidfoot has this option though, but I don't know.
386
387
388
389
390
391
392
X