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
How to optimise my code?
By Arkin, with 1 reply.
Replied to by davmac, over 7 years ago:
There are possibly a lot of things you could do, though I only scanned your code quickly. One thing that stands out: the technique you use to find a single object: <Code Omitted> ... is pretty inefficient; it needs to scan through all objects and filter out those except for the one of the specified type. If it's just a singleton, you could store a reference to it in a static variable instead (eg have a static variable "instance" in the Jambe_p2_1 class and set it in the constructor).
get a variable from object at offset from another actor
By Arkin, with 4 replies.
Last reply by Arkin, over 7 years ago:
I found how to do this! <Code Omitted>
Passing a variable and Output
By dbutts1@stumail.com, with 2 replies.
Last reply by dbutts1@stumail.com, over 7 years ago:
Thanks for pointing that out. Should be .12,.15,.20. I'll look into it in the morning. Too many hours make simple mistakes get more plentiful.
Dice rolling at the same time?
By WardedBowl403, with 1 reply.
Replied to by danpost, over 7 years ago:
If your die objects are supposed to roll (that is, it is a behavior of a 'dice' object to roll), then you should have a 'roll' method in the 'dice' class. Also, if your die objects are to have values (that is, it is a state of a 'dice' object to have an integer value -- which, in turn, determines its image), then you should have an integer field in the 'dice' class for that value. Methods implement behavior and fields track states of an object. Lines 6 through 8 of the 'clicked' method are pointless as the 'dice' object created is immediately lost once the 'if' clause has finished executi
How to make a new object type appear to replace another
By protocolUnknown, with 3 replies.
Last reply by protocolUnknown, over 7 years ago:
danpost, that worked! I did not realise that that might be the problem. Thanks a lot.
Decimal.Format
By dbutts1@stumail.com, with 2 replies.
Last reply by dbutts1@stumail.com, over 7 years ago:
Thank you. I've been looking at this so long I see that my main issue was I never put in import java.text.DecimalFormat;
Button not working :(
By PeloviaOliver, with 4 replies.
Last reply by danpost, over 7 years ago:
Maybe you did not understand what I was trying to say above. You need to change the offsets at which you check on the color. If you really want to check that it moves at all, change 'canMove()' to 'true' on line 11.
I dont know what to do
By Bandito, with 14 replies.
Last reply by Bandito, over 7 years ago:
alright sorry, that I answered it so late but my comment was reported for being potential spam, i figured everything out thanks though
Why does this not work?
By Simon1122111, with 16 replies.
Last reply by Simon1122111, over 7 years ago:
ok thank you very much!
Problem with showing the images
By qazxsw21, with 8 replies.
Last reply by danpost, over 7 years ago:
Change line 51 in the Enemy class to 'else if ...'.
Changing characters in a string to all caps
By WardedBowl403, with 2 replies.
Last reply by WardedBowl403, over 7 years ago:
Oh wow. I did not know that existed. Thanks!
How to remove text?
By WardedBowl403, with 1 reply.
Replied to by danpost, over 7 years ago:
What text are you trying to remove? are you trying to replace that text? do you not have a Message class? Need more information and code?
Runtime Error Window
By suzbo, with 2 replies.
Last reply by Super_Hippo, over 7 years ago:
See this discussion:
https://www.greenfoot.org/topics/58676/0#post_115370
ERROR: Class java.awt.Rectangle was not found
By Busch2207, with 6 replies.
Last reply by Yehuda, over 7 years ago:
The same way it used to only work on certain browsers and only if you allow it (in java control panel).
Animated Gif
By suzbo, with 5 replies.
Last reply by danpost, over 7 years ago:
Along with your fields declared on lines 12 and 13, add a GifImage reference field and assign a GifImage object given your gif file: <Code Omitted>The gif file should be in the 'images' folder of the project folder. Line 25 should be: <Code Omitted>This line initializes your world background image. The same line of code should also be in the 'act' method of the class to run the animation when the scenario is running.
302
303
304
305
306
307
308
X