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
Keeping Score
By pr2alede, with 2 replies.
Last reply by danpost, over 10 years ago:
Have two field in your world, one for the current time and one for total combined time. Call them 'time' and 'totalTime'; and make them 'public' fields. Then when one level is ended and you need to move on to the next, use something like this: <Code Omitted>
How to open a new level
By CreepingFuRbalL, with 1 reply.
Replied to by Gevater_Tod4711, over 10 years ago:
To check whether there are no more objects from a class you can use this code: <Code Omitted>If you add this code in a World subclass leave out the getWorld(). To set the world to a new world you can use the method Greenfoot.setWorld(World) e.g. like this: <Code Omitted>
Score Counter problems
By Acummings, with 7 replies.
Last reply by danpost, over 10 years ago:
thefutureisnow wrote...
Well, (and I'm not sure exactly how well this would work). You would create a class (not a world or an actor class), and you would set score variables for it (make sure they're public, and if you set them private, make sure you have public methods in that class that can edit and view that variable). And then you would just do the following: <Code Omitted>Of course, make sure that you modify this for the correct variables.
All this does is create another object (just not a world or actor object) that is referenced in the first world.
Need help understanding code
By Gummy, with 3 replies.
Last reply by danpost, over 10 years ago:
You would use both lines of code. The initial line in question to create the object followed by the statement to add it into the world. Review the code that is put into the 'prepare' method when you 'Save the world'.
Heath hearts problem
By PrezHawkeye, with no replies.
I'm trying to get my game to reset after the player loses a heart and when it reaches 0 the game ends. I also need the game to remember the score so that it will leave off where it was when the player died. My actor died with the eat method from the crabworld game. Also how do i increase the size of my health bar? <Code Omitted>
Won't Compile
By snobiz45, with 6 replies.
Last reply by snobiz45, over 10 years ago:
Thank you!
Sound problems again
By Yedya, with 4 replies.
Last reply by Yedya, over 10 years ago:
Is there a way arond this?
Kinect Programming for Jump
By IamPicker, with no replies.
Hello We are working on a game where user needs to jump to pass over a Monster . We searched all over the internet to get a hint on how to recognize a jump in Kinect,but our efforts went in vain. It would be great if someone here could help us on this. Thanks in advance.
New Characteristic in new level
By pr2alede, with 2 replies.
Last reply by pr2alede, over 10 years ago:
Great that has worked
Tricky situation... Get the nearest object
By Jonche, with 11 replies.
Last reply by danpost, over 10 years ago:
Remove the 'static' keyword from <Code Omitted>Each monster will then have a healthPoints field of its own.
internatinal karate +
By wa7sh89, with no replies.
hello guys ,, iam working on a project that simulates this game which an arcade game from the 90's http://i42.tinypic.com/24pe7vp.jpg but iam stuck in somewhere ,, first how to make the white clothed guy ( Ryu ) to move randomly horizantally i made some code for that but its not working as i wanted it to do ,, second i want him as well ,, to play automatically ,, to hit ( ken ) .. i wonder if setImage method and delay method can do that with an array ,, ? can some suggest a code for me ,, last thing if iam going to apply somthing like a life bar ,, it should be decreased with every hit the player gets from the other player ,, can ( isTouching method ) and ( setImage ) method with an array can help doing that ? i upload it the game as .rar file on an external site as greenfoot refused to upload it since its too large !! and i didnt know how to make a jar file !! please guys feel free to comment me and correct me as much as u can to get this issue done ! coz its only these three proples ,, otherwise the game is done for me ,, as i know wt should be done :) regards !! here is the link http://speedy.sh/KpnFW/project.rar
the code
Unreachable statements
By jsheehan, with 6 replies.
Last reply by davmac, over 10 years ago:
Yes, I already gave you the solution to that in my first post:
The 'if' statement always returns, so the next line can't possibly be reached. The return statement stops any further code in that method from running. As there is a return statement in every branch of the if-statement, it must always return and so the next line - "List obstacles = ..." - can't possibly be reached. It looks to me as if you should remove the 'else { return true; }' part completely.
World background keeps changing back
By mwishum, with 6 replies.
Last reply by danpost, over 10 years ago:
As long as a reference is kept to any already created world, you can return to it by using the reference (without using the 'new' keyword, which would create a world in its initial state).
Need help with collecting a key to unlock a door for my game
By alicija, with 11 replies.
Last reply by alicija, over 10 years ago:
Sorry, I didn't take notice of line 28. I've got it all sorted now! Thank you heaps! :)
Resolution
By Kartoffelbrot, with 1 reply.
Replied to by bourne, over 10 years ago:
Maybe something like this is what you want? : http://stackoverflow.com/questions/10123735/get-effective-screen-size-from-java
757
758
759
760
761
762
763
X