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
Please help with java.lang.IllegalStateException: Actor not in world. An attempt was made to use the actor's location while it is not in the world. Either it has not yet been inserted, or it has been removed.
By powderbanana, with 1 reply.
Replied to by danpost, almost 9 years ago:
After line 26 in the Balloon class (where you are removing the balloon from the world), add a 'return;' statement so execution of further statements in the method are not attempted.
Need Help With My Pong Inspired Game
By Frost.D, with 8 replies.
Last reply by danpost, almost 9 years ago:
I was thinking of something more along these lines (this is not equivalent to your new code as you have made some major changes):
wats this
By Nosson1459, with 1 reply.
Replied to by danpost, almost 9 years ago:
Nosson1459 wrote...
<Code Omitted>wat does this code mean and how can i change the speed
It depends on the context that it is being used. Will need to see the method that line is in plus the RunWorld class code (at least).
how can i remove an object when i click on something from another world
By hockeydude1155, with 2 replies.
Last reply by danpost, almost 9 years ago:
If you had the Hero2 object reference in an instance field and a method to return that Hero2 object in the City class: <Code Omitted>then you could remove it specifically with: <Code Omitted>
Delay a single object
By Idadorable, with 3 replies.
Last reply by danpost, almost 9 years ago:
Idadorable wrote...
Thank you!
I guess that the 'if' statements can be combined as follows: <Code Omitted>
Problem with mouseclick event
By chandra, with 1 reply.
Replied to by danpost, almost 9 years ago:
Your mouseClick needs to be on the actor, not on the image. Use 'this' to refer to the actor the act method is executing for. I do not believe you need to reset the image to the actor (your last code line).
Mouse press-and-drag rotation of actors.
By MrEvans, with 1 reply.
Replied to by danpost, almost 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, almost 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, almost 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, almost 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, almost 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, almost 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, almost 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, almost 9 years ago:
Ok, makes sense. Thanks again!
Jump Once per Key Press
By gmacias, with 2 replies.
Last reply by gmacias, almost 9 years ago:
Ok, thank you!
429
430
431
432
433
434
435
X