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
Detecting an Image
By Y3llowMustang, with 3 replies.
Last reply by Gevater_Tod4711, over 11 years ago:
You can use the methods
getIntersectingObjects
or
getOneIntersectingObject
from the greenfoot API to detect whether your actor touches another actor. The method getIntersectingObjects will return a list of objects and getOneIntersectingObject will only return one object. You can use this methods e.g. like this:
The current code im using for my character,how do i add lives?
By CreepingFuRbalL, with 3 replies.
Last reply by Gevater_Tod4711, over 11 years ago:
To add the variable you can use this code: <Code Omitted> To make your actor loose a live when it hits another actor is easy. Try it like this: <Code Omitted> The only problem is that after you lost a live the actor will still be there and your actor will get hurt again. Do you want to remove the other actor after it has hit you
Need help with adding a spawn point to the world
By CreepingFuRbalL, with 1 reply.
Replied to by Gevater_Tod4711, over 11 years ago:
The easyest way to add a spawn point would be to add new objects to the world when a condition is fullfiled: <Code Omitted> This will make new objects spawn when there are less than it should be.
Also how to add health or lives onto the game
By CreepingFuRbalL, with no replies.
Hi id also like to add health/or lives in my game so that if one life goes my actor can respawn with 2 other attempts
Need Help Animating Actor
By Otaku_Programmer, with 6 replies.
Last reply by danpost, over 11 years ago:
We really do not have enough information to help at this point. Best might be to post the code for the whole class.
Counting the number of a certain class in the world
By TobyW, with 7 replies.
Last reply by danpost, over 11 years ago:
If any basic key can unlock any basic door, then all you need to do is: <Code Omitted>With this, you do not need to keep track of ANY amounts. If there is a special key and door, you can use separate classes for those classes and work them separately.
Create a scoreboard
By kdoulas1228, with 3 replies.
Last reply by danpost, over 11 years ago:
It appears you imported the Scoreboard class and then edited it, ruining the basic structure of the class. (1) the field 'scoreCounter' field is not declared or initialized anywhere (not sure if that method belong in this class) (2) only the first statement (the 'return...') is reachable in the 'getScoreCounter' method (see note parenthesized in (1)) (3) the last block (starting '{ if(UserInfo.isStorageAvailable())...' is not within a method (4) the 'SCORE' field is being set to 'newScore', yet 'newScore' seems to come from nowhere (I think you delected a constructor declaration for the bl
Changing a string into an integer?
By a_quiet_person, with 4 replies.
Last reply by mjrb4, over 11 years ago:
Gevater_Tod4711 wrote...
To convert a String to an int you can use the method Integer.parseInt(String) which returns the int value of the String. This method throws a NumberFormatException so you need to surround it with a try catch block. <Code Omitted>
NumberFormatException is an unchecked exception, so you don't *need* to surround it with the try catch block (though you may wish to if you're parsing something that may not be a valid integer, user input for e
score
By sH1R1U, with 2 replies.
Last reply by sH1R1U, over 11 years ago:
:O thank you i try use in my game thanks again
sounds for java
By sH1R1U, with 2 replies.
Last reply by sH1R1U, over 11 years ago:
:O thank you so much :D i can't found any pagr :D
Gum ball machine
By Th3j4, with 7 replies.
Last reply by danpost, over 11 years ago:
Again, in order to assist in removing the text, you need to show how it is displayed. "Show your code!".
plz help
By manish123, with 5 replies.
Last reply by manish123, over 11 years ago:
ok ill try these solutions, thanks!
Trouble with bg music
By DownKost, with 2 replies.
Last reply by danpost, over 11 years ago:
With the code given, once line 25 executes you will lose the reference to the GreenfootSound object (in fact, you will lose any connection to the 'musica' world that will no longer be active). You could avoid the lose by passing this world on to the next, but I really do not see any real benefit by having a separate class for music control. Better might be to put the GreenfootSound field declaration statement and the two methods in one of your other world classes. It would help to know your world class structure before offering any advice as to where it might be best to move them.
pokemon fighters
By Meira, with 2 replies.
Last reply by FlyingRabidUnicornPig, over 11 years ago:
Awesome. Although I prefer making pokemon fight until they faint, much more humane. Also, this topic should be under other, not programming.
On 'The Maze Factory' by danpost
By danpost, with no replies.
This is in response to a question in a comment on one of my scenarios. The code I used for the Timer class follows: <Code Omitted>The timer starts the moment the timer object is created and only has a 'stop' method. It can easily by complimented with methods like 'start', 'reset', 'getText', 'setText', 'getElapsedTime', etc. or modified to not start until the 'start' method (which needs added) is called.
794
795
796
797
798
799
800
X