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
Changing font inside of a score counter
By RawbyTheSheeth, with 1 reply.
Replied to by danpost, about 11 years ago:
I do not know how easy it would be to change the default font of a new GreenfootImage object (if it is at all possible). However, I have a subclass for the GreenfootImage class that makes text images that use a given font. It is located in my
TextImage Support Class
scenario.
Need help with a scrolling world
By Sranang, with 1 reply.
Replied to by Super_Hippo, about 11 years ago:
<Code Omitted> You could do it like this.
Having difficulties with randomly moving objects
By cha0204, with 8 replies.
Last reply by Super_Hippo, about 11 years ago:
The 'resetBoolean' method is needed as you do it. (In my scenario I just set them to 'true' or 'false' every time, but you can also do it like this. The 'changeDirections' method... well, I was thinking of something like this:
jump
By amit_27980, with 1 reply.
Replied to by danpost, about 11 years ago:
What code have you tried?
New JFrame
By JetLennit, with 4 replies.
Last reply by NikZ, about 11 years ago:
Super_Hippo wrote...
I don't know what a JFrame is. I think I saw it once when testing out Eclipse, but I didn't understand anything there, so I moved back to Greenfoot where I don't need such things... Did you update to Java 8? Maybe this causes the problem like it blocks the storage. But it could be completely different, just an idea. ;)
It is a pop up box/frame. Add JComponent to it for content.
Create an exception to some classes
By MySelfLuls, with 6 replies.
Last reply by danpost, about 11 years ago:
Line 1: * the 'enhanced for' (or 'for each') loop -- see lower half of
this page
* the 'getObjectsAtOffset' method-- see
Actor class documentation
* the 'removeAll' method -- see
List class documentation
Line 3 assigns the object from the resultant list to an Actor field. This is so the object will be looked upon as an Actor object, not just an Object object (necessary b
Character goes through the platform (from below)
By sunjay001, with 1 reply.
Replied to by Super_Hippo, about 11 years ago:
If the onGround works, you can probably write similar code to check for above the player. There is probably something like 'getOneObjectAtOffset(0,/*something positive*/, Ground.class)'. If you change the positive value to a negative one, it will check above the player.
Is there a method or command to open up the java documentation?
By BryanGSMST, with 1 reply.
Replied to by danpost, about 11 years ago:
If you mean something like what
this scenario
does, then, well, yes; but it is not a command or method, it is a button actor (in one world) and a world subclass that displays a text file (in another world). You will need to add a '.txt' file to your scenario folder by opening up the '.java' class file and saving it in the same folder as a '.txt' file if you want an uploaded version to work properly (the '.java' files are not placed into the scenario folder on the site, but any extra '.txt' files will be placed there).
'(' expected?
By Fuzzion, with 2 replies.
Last reply by danpost, about 11 years ago:
The following line is incomplete: <Code Omitted>It should be: <Code Omitted>with a set of open and close parenthesis after the name of the method.
Problem by using scenarios with UserInfo
By Busch2207, with 2 replies.
Last reply by Busch2207, about 11 years ago:
Ah, ok! :) Thank you, that really helped! :)
to make a transparant graphic
By Nirmala, with 13 replies.
Last reply by danpost, about 11 years ago:
Yes. After adding the 'TScreen' world and having that be the initial world, the 'started' method in the 'world' world is no longer executed (the project is not started with that world being the active world). Just add the line: <Code Omitted>as the last line in the 'world' class constructor ('public world()').
possible to combine objects by glueing them together?
By 11770, with 10 replies.
Last reply by 11770, about 11 years ago:
alright although I have run out of time for the project as I have no more free time until its due haha i'd like to finish it I already meet the req to get 100% thank you guys
Checking whether an object is of a specific class
By classicjimmy, with 3 replies.
Last reply by classicjimmy, about 11 years ago:
Thanks, that's really simple and beautiful.
Passing a boolean value to subclass
By Nubbit, with 69 replies.
Last reply by GreenfootStars, about 11 years ago:
danpost wrote...
The snippet can be simplified to this: <Code Omitted>
This was great! :) Managed to finish the whole thing. THANK YOU SO MUCH danpost and Super_Hippo! You guys are amazingly awesome and have really saved my ass!
Walking and jumping
By JeppDev, with 4 replies.
Last reply by BenMcBen, about 11 years ago:
danpost wrote...
@BenMcBen, that is not quite how it would work out when calling 'getKey' multiple times. Keystrokes are temporarily saved in a buffer. Think of it as a list where each keystroke value is added to the end of. If the list is empty, 'null' would be returned by 'getKey'. If not, the first item in the list is returned AND also removed from the list. So, any successive call to 'getKey' would return 'null', unless there has been enough time between calls that more than one keystroke could be made -- in which case, the second keystroke would be returned on the second call, etc.
639
640
641
642
643
644
645
X