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
Need help with Location of an object
By MetinPlays, with 3 replies.
Last reply by MetinPlays, almost 9 years ago:
Ok I've made it, thanks a lot!
Keeping track of Multiple Actors in a Class
By xbLank, with 4 replies.
Last reply by xbLank, almost 9 years ago:
Great way to look at it. Merry Christmas.
Adding my old move method but with new variables?
By Recorsi, with 5 replies.
Last reply by danpost, almost 9 years ago:
In the overriding method add the following line: <Code Omitted>
help!
By agray11202, with 4 replies.
Last reply by Super_Hippo, almost 9 years ago:
Either in the act method or a method which you call from the act method. There is nothing wrong about just putting it into the act method.
help!
By agray11202, with 2 replies.
Last reply by danpost, almost 9 years ago:
agray11202 wrote...
is it possible to make an if statement when a certain object is touching a certain color???
Why not this: <Code Omitted>where 'touchingColor' returns a boolean value indicating the touching state. The parameters would be any information the method might need in order to make the determination on that state. So, the answer to your question is --- Yes. I really do not want to appear so blunt, vague or general about it; but usually, help can only be given in proportion to the amount of information provided.
Want to make my enemies shoot
By Kordus, with 2 replies.
Last reply by danpost, almost 9 years ago:
If you were to put a comment on the 'canSee' method, it should read: <Code Omitted>The center being the location gotten from '(getX(), getY())'. So, the 'shootPlayer' method will need to use something else to determine when to fire. It will also need another condition to limit how often a projectile is fired when the player is in range. This can be a random chance thing or a regular or randomized timer.
Background music
By Kordus, with 6 replies.
Last reply by Kordus, almost 9 years ago:
Thankyou Super_Hippo and nolttr21
How to make this rectangle move
By jacquelinereilly, with 24 replies.
Last reply by jacquelinereilly, almost 9 years ago:
Got it working -thank you!
Impassible Walls
By jett, with 4 replies.
Last reply by danpost, almost 9 years ago:
jett wrote...
danpost wrote...
What is the code to the act method?
<Code Omitted>
This is before your moving things around. What I see here is that you move and then check for collision. But the 'originalX' and 'originalY' are acquired after moving; so, it is like -- good luck moving back. That is, they acquire the new coordinates of the actor -- not the original ones.. Now, with the new code, I see you checking collision before moving. How is this to work if the actor is
Actor doesnt act() after creation
By MuellerO, with 1 reply.
Replied to by danpost, almost 9 years ago:
I would, first off, think that line 4 would show an error and the project would therefore not compile. Also, line 15 looks like it may produce some errors during specific circumstances. It also looks like a single sheep could produce an abundance of new sheep when eating grass. Insufficient code was given to determine why you are getting your current behavior. Please show the code for the entire Sheep class.
Accesing a method from another Actor
By Banchion, with 3 replies.
Last reply by nolttr21, almost 9 years ago:
right after the "int a = 0;" line add this line without the quotes: "public boolean clickedOnce = false;" then use this code in place of your Click() method <Code Omitted>
how do i make this character jump
By JoyBajwa, with 3 replies.
Last reply by danpost, almost 9 years ago:
JoyBajwa wrote...
I am new to programing and I want to make the character jump and i want to learn how you made your game so may please request to see the code of you game so I can learn from my mistakes. Ill also upload my game after its finished.
You can click the buttons along the bottom of the window while running the scenario to view the codes used.
Move multiple actors including constructors
By HugoTroop, with 1 reply.
Replied to by danpost, almost 9 years ago:
Constructors, in general, do not have anything to do with any actors in the world. I do not understand what you mean by "movement is done in a constructor". Certainly, the object being created is not yet in any world; so, "movement" is meaningless for it at the time the constructor executes. The turrets need to keep a reference to the hull they belong to so they can move with them.
help!!
By agray11202, with 1 reply.
Replied to by Super_Hippo, almost 9 years ago:
The size of an actor is defined with its image. So if you change the size of the image, the size of the actor changes as well.
Multiple Lives
By massivassl, with 3 replies.
Last reply by danpost, almost 9 years ago:
massivassl wrote...
so how would i make make it such that all soldiers share the same counter?
One way is to make the field 'static'. But you must ensure that you zero the field in your initial world constructor or the value will carry over from game to game. However, if all soldiers are removed from the world when they die, you do not have to keep track of how many are still in the world. You can simply use the following in your World subclass act method: <Code Omitted>
302
303
304
305
306
307
308
X