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
Create an exception to some classes
By MySelfLuls, with 6 replies.
Last reply by danpost, about 12 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 12 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 12 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 12 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 12 years ago:
Ah, ok! :) Thank you, that really helped! :)
to make a transparant graphic
By Nirmala, with 13 replies.
Last reply by danpost, about 12 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 12 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 12 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 12 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 12 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.
Score Updates, but Proton Charge Does Not
By BryanGSMST, with 11 replies.
Last reply by danpost, about 12 years ago:
This issue is the result of having more than one field trying to track the same value. You may think that it is easier to get the value of a field from one class to another by doing so; but, that is not the case -- especially when you are using a field that is 'static' (or multiple fields that are 'static'). Here, you have a static field 'protonDelayCount' in your Rocket class and a static field 'value' in your ProtonCounter class. Then you have added a method 'getCharge' (which, by the way, is probably what should have been used in the act method before the 'update' method call). First, '
Image Not Updating
By BryanGSMST, with 1 reply.
Replied to by danpost, about 12 years ago:
Please refrain from creating multiple discussion threads on the same issue.
Sliding problem in my 2D Game
By MySelfLuls, with 3 replies.
Last reply by danpost, about 12 years ago:
You could apply more friction (add and subtract 2 instead of 1).
Quick Guidance / Direction for following pathway of dots
By ozcorps, with 15 replies.
Last reply by Super_Hippo, about 12 years ago:
What? :o
Please help, I want to collect all objects from a certain class and check a specific value of a variable..
By tummie555, with 5 replies.
Last reply by danpost, about 12 years ago:
Creating a new object type for something that can be dealt with by using a simple int field seems a bit much. And, unless you are adding the Regel object created into the world, the class does not have to extend Actor (you can either remove 'extends Actor' altogether or change it to 'extends Object').
641
642
643
644
645
646
647
X