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
Mouse press-and-drag rotation of actors.
By MrEvans, with 1 reply.
Replied to by danpost, about 9 years ago:
The Greenfoot class method 'mousePressed' only returns true when a mouse button goes from an unpressed state to a pressed state. It does not return true if there is no change in the state of a button. Therefore, your 'else' block needs to be removed and you need to use another set of conditions for detecting when the state is changed back: <Code Omitted>would work by itself, if you are okay with the possibility that it could be the other mouse button that is released. <Code Omitted>will pr
Key Release
By BGallino3, with 1 reply.
Replied to by danpost, about 9 years ago:
To detect, not the state of, but a change in the state of a key, whether it be the pressing or the releasing, you will need an instance boolean field to track the state of the key: <Code Omitted>
Need to make a sensing mechanism that allows an actor to move towards specks of Dirt
By thebruus, with 9 replies.
Last reply by danpost, about 9 years ago:
thebruus wrote...
I can't figure out how to curb the collision check problem, which, as Danpost pointed out, executes before the actor is in the world.
With the code Super_Hippo supplied, you can just remove line 23 (from your last posting of the Roomba class). If you use '/**', with two asterisks, for your multi-line comment blocks (whether they are actually multi-line or not), your code will display better here.
detection
By Nosson1459, with 6 replies.
Last reply by danpost, about 9 years ago:
Nosson1459 wrote...
and btw those were <Code Omitted>not
Still collision detection -- none the less. You were saying to allow a move to the right if not touching Door object or DoorPost object. That is the same as "don't allow a move to the right if touching both". Actually, I think you should probably use the AND conjuction, '&&', not the OR conjunction, '||', there at line 65 of the Pengu class (if not touching one AND not touching the other). At any rate, my point is that it does not matter that you used NOT, '!'; it is still collision checking.
Is there a way to system.out.print in world rather than the terminal?
By shivzzz123, with 8 replies.
Last reply by danpost, about 9 years ago:
shivzzz123 wrote...
can you give me an example of how i would be able to display the word and update itself each time a letter is guessed
By convention, class names begin with uppercase letters (I will use the name Word since it will display the word (with underscores -- or not). This is a brief summary of what is needed only to sow you an example:
Dragging with the mouse
By behappy2, with 14 replies.
Last reply by danpost, about 9 years ago:
The field type on line 6 should be 'boolean' -- with a lowercase 'b'. Using an uppercase 'B' will have the field treated as an Object field reference of type Boolean instead of as a primitive type boolean field. As an object reference, its default value is 'null'; as a primitive field, it is assigned a value of 'false' by default. Also, all your multi-line comments should begin with '/**', using two asterisks. That way, at least in the postings here, some of your code lines will not look like comment lines because of their text color.
Enemy not spawning with current method, no syntax but no spawn
By JWK3986, with 2 replies.
Last reply by JWK3986, about 9 years ago:
Ok, I see where I went wrong. I cut Line 23, created an act method in my World class and added the spawnPuffer method to it, and adjusted the If statement condition in order to slow down the spawning rate since at 20% it seemed ridiculously fast. I also commented out line 83 and it works as intended still, that line may have been redundant. Thanks for the help, once again lol.
Need help creating the effect of moving ground
By JWK3986, with 12 replies.
Last reply by JWK3986, about 9 years ago:
Ok, makes sense. Thanks again!
Jump Once per Key Press
By gmacias, with 2 replies.
Last reply by gmacias, about 9 years ago:
Ok, thank you!
MP3 player with Vol up and Vol down buttons
By ED1990, with 3 replies.
Last reply by danpost, about 9 years ago:
I kind of figured that the Volume class was for displaying the current volume -- just wanted to be sure of that and that there was nothing there that might influence the current volume. From your last post, it appears that there may be a bug in the implementation greenfoot has for sound volume with your version.
Screen Wrap
By LimeLava, with 1 reply.
Replied to by LimeLava, about 9 years ago:
Never Mind I used a different thing and figured it out
How would I gradually increase the size of an image?
By Astralman, with 3 replies.
Last reply by Astralman, about 9 years ago:
Thanks guy :)
@danpost fix my breakout game
By JarJarBanks7, with no replies.
its on my profile
im trying to spawn a drone every time i = 4
By hockeydude1155, with 6 replies.
Last reply by danpost, about 9 years ago:
Try <Code Omitted>Your line 12 needs to be moved outside the method, though.
How do I make a global variable, or at least something that works like one?
By wasd, with 2 replies.
Last reply by danpost, about 9 years ago:
Use instance 'private int' fields in your world class and add a 'public int getInteger_()' for each one so the actors can access the value of them with (using MyWorld as world class name): <Code Omitted>You can change the underscores simulateously to whatever, for example 'A', 'B', 'C', ..., for each field. Actually, you can name they whatever you want, I just wanted to point out that all underscored names are referring to the same field.
430
431
432
433
434
435
436
X