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
Fixing if objects are intersecting
By The_bazm, with 3 replies.
Last reply by danpost, over 7 years ago:
The_bazm wrote...
ok. my current situation is that if the player is for example IN a block he should get teleported on the block. This is fine and also works. But my problem is that when the player even touches something he gets teleported up, too. For example if there is a jump and you would touch the wall or an element at the bottom normally the player just should continue falling. But now he teleports because of this method up and you can skip the whole level.
Sounds like a jump-and-run type scenario. You will probably have to deal with horizontal and vertical movements separately
Starting using Enter
By Thotson, with 3 replies.
Last reply by danpost, over 7 years ago:
The only way to run a scenario from a stopped state is by clicking the "Run" button. You can have your scenario start automatically and then wait for "enter" to be pressed while in a running state as the following depicts: <Code Omitted>
Put objects automaticly into my world
By Gre3n0, with 2 replies.
Last reply by danpost, over 7 years ago:
Gre3n0 wrote...
Which code do I need if I want to put objects in my world if I press run? I mean that the objects get placed by greenfoot.
I believe you want to use the
started
method of the
World
class.
Cannot Remove Acto in myWorld when I Click another Actor
By AlexandraGrace812, with 1 reply.
Replied to by danpost, over 7 years ago:
Move line 21 to outside of the method. As is, you are creating a different
selector3
object every
act
step; so, if one is added to the world, it will not be referenced when it is time to remove it. A different
selector3
object (the one created on that act step) will be referenced.
I want my rain drops to fall down vertically. What is the code.
By lucky555, with 8 replies.
Last reply by danpost, over 7 years ago:
lucky555 wrote...
We want the Bone class once it is touched by the Dog class to pile up the bones in the right corner of the World.
You want to add a new state to the bones. The state of being collected or not. States are described by fields. Since there are only two possible states for collected (being or not being), a
boolean
field is in order. After line 43, add code to check for an intersecting
Dog
object. If found, find a place in the corner for the bone and switch the
boolean
value. Since the bone must cease and desist in this state, add the following at
Help using showtext and simple integers
By CROCKETTROCKETT4, with 2 replies.
Last reply by CROCKETTROCKETT4, over 7 years ago:
I owe you my life. Thank you Danpost
Level Progression
By SymInvader, with 13 replies.
Last reply by SymInvader, over 7 years ago:
I just figured out the problem and it's all resolved now. The last thing I need to help with now is the high score system, because every test where I score higher than the last high score, it still doesn't change. Putting in the code for the high score below, and below that, the code for it to display. Hope somebody replies soon. Thanks!
EMERGENCY, ASSIGNMENT DUE TOMORROW
By Chelseayxz, with 1 reply.
Replied to by Chelseayxz, over 7 years ago:
Nevermind! problem solved!
Help With Droppable Characters from a menu.
By JordiC, with 1 reply.
Replied to by Super_Hippo, over 7 years ago:
I am not sure how I would do it. There are several ways. For example: -- Have one class for the plants. No matter if they are shooting, dragged to a possible position or in the menu. Have a variable to track what it is doing right now and act accordingly. So have it start at 0 (=in menu). When clicked, add a copy with 1. At 1, follow the mouse. If clicked at a possible position, "drop" it, set the variable to 2. If at 2, shoot, react to being attacked… -- Have one class for the plant in the menu (menuPlant) and one for the plant on the field (fieldPlant). The world handles which object in
World not being able to walk everywhere
By loldertroll, with 1 reply.
Replied to by Super_Hippo, over 7 years ago:
Hm, I think the best way would be to move and then call a method on the active world and check if the character is in a cell which is allowed. If not, move it back to where it was.
dashing
By loldertroll, with 1 reply.
Replied to by Super_Hippo, over 7 years ago:
What is a dash?
I'm having trouble keeping the same score across different levels
By Dan143, with 30 replies.
Last reply by AmyIsBadAtCoding, over 7 years ago:
This is my code. The reason why I have been using this thread because I've genuinely been told off for making different threads when others have similar issues by who I think was a mod lmao. Here's my code, this has the change world code in:
guys whats wrong? help
By loldertroll, with 2 replies.
Last reply by loldertroll, over 7 years ago:
ty
GreenFoot Coding Question
By DrakeGuo, with 1 reply.
Replied to by Super_Hippo, over 7 years ago:
You use it after every command. For example: <Code Omitted>
Making an Object Disappear When Clicked Using Coordinates
By rb6333, with 1 reply.
Replied to by Super_Hippo, over 7 years ago:
When the mouse was pressed, you can get the current location of the mouse with the use of the MouseInfo object. Then you can either check if the mouse X and Y coordinates are between xMin/xMax and yMin/yMax (if cellsize>1 at least) and remove your object then. Or you move an invisible helper object to the position of the mouse, get a list of all object in a small range with the getObjectsInRange method and if your object is one of them, remove it. (To see the methods and how they are used, visit the API with this link
https://www.greenfoot.org/files/javadoc/
or by double clicki
184
185
186
187
188
189
190
X