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
Help with sorting an array of objects
By Asiantree, with 17 replies.
Last reply by danpost, over 9 years ago:
Asiantree wrote...
Like this? <Code Omitted>Sorry I am extremely close to finishing this, and your help has definitely been appreciated.
I think your comparisons of the totals is not correct for the order you want (change the 2nd '<' to '>'). FYI, you either switch the order of elements compared or switch the comparison operator, but not both, as that just results in no change in the comparison at all.
The ball needs to bounce in a random direction, except in 90 and this is for a ping pong game
By Beatmaster42, with 11 replies.
Last reply by Beatmaster42, over 9 years ago:
Thanks for the help and the sound started to play after I restarted my computer. thanks again
Array and addObject Help
By UnusualGorilla, with no replies.
So I am trying to make it so that if I press the "L" key a file dialog will pop up, and take three integers (the rgb colors) to create a new ball. However, the only thing that happens is the first ball will be added to the world, but the rest of the balls are not added to the world. Could anyone help me figure out what I am doing wrong? I have included the three classes that are needed for this code. <Code Omitted> <Code Omitted> <Code Omitted> Thanks in advance!
Code to make a number gradually grow
By RustuMan, with 3 replies.
Last reply by danpost, over 9 years ago:
RustuMan wrote...
So how would that look. Its not really working for me.
Insert the following line in the act method: <Code Omitted>
Attacking Method
By ProdigyF, with 1 reply.
Replied to by danpost, over 9 years ago:
ProdigyF wrote...
I'm making a game where there is a knight and he attacks Minions; the Problem I am having is the removeObject method isn't working. The Class won't delete. Any Ideas on what other methods I could use to make the "Minion" get removed?
You never delete (or remove) a Class -- you remove a single Actor object or a List of Actor objects. The 'removeObject' method removes a single Actor object. We cannot, however, correct your code without seeing what you have.
code doesn't work
By kursatA, with 6 replies.
Last reply by danpost, over 9 years ago:
kursatA wrote...
Super_Hippo wrote...
Make sure you don't remove the object before calling the 'actor1' method.
what do you mean by this
What is meant is that: <Code Omitted>the actor is being removed from the world, probably with a line like this: <Code Omitted>The removing line could be in a method called between those two points.
Adding smoke to Object on Collision
By ENDLING, with 1 reply.
Replied to by Yehuda, over 9 years ago:
Either you have an instance of the Object that you want the smoke to follow then you can get the x and y of the actor for the smoke, or you check for an intersecting object and then set your x and y to those of the intersecting object (which basically is the same as the first way since your getting an instance of it with the method).
test for an object's location
By rn42v1r, with 4 replies.
Last reply by rn42v1r, over 9 years ago:
Ah ok. I noticed that, just was curious about the "list" thing. Thanks again
Help with storing values into an Array of an object to be used by another class
By Asiantree, with 22 replies.
Last reply by Asiantree, over 9 years ago:
I also have a button sub-class, so I am not sure if I should take that into consideration when working with the button. Here is the main ToggleButton class:
HEALTH BAR
By kursatA, with 1 reply.
Replied to by danpost, over 9 years ago:
kursatA wrote...
can someone help me create a health bar for my cannon, needs to be hit 3 times to disappear and then 'game over' screen. anyone?
Please see my
Value Display Tutorial
scenario.
Wheres my error?
By ali18, with 19 replies.
Last reply by ali18, over 9 years ago:
Sorry, i just wanted to ask something else. Do you know i am able to make my bullets disappear when it hits the rockets and also make an quick explosion??<Code Omitted>This is the code in my plane
getNeighbours help.
By Reny, with 1 reply.
Replied to by danpost, over 9 years ago:
The 'getNeighbours' method is more for gridded world (worlds that have a cell size greater than one where actors
usually
fit inside one cell). The 'getObjectsAtOffset' method might work a little better (in fact, you can use it four times to check on all four sides of the actor). If I read the instructions you gave correctly (presuming that the wording is correct), then you need to use at least two "List" methods (like 'get(int)', 'isEmpty()' and 'size()', to name a few methods that could be used).
Creating a world with resized images
By alittleteacher, with 5 replies.
Last reply by danpost, over 9 years ago:
You can scale the image to size before the world is created; however, you would need to use static content and it will happen during compilation of the project (before any World object is created): <Code Omitted>
How to get/call method from touching object
By Casper, with 2 replies.
Last reply by Casper, over 9 years ago:
Thanks
A counter that always goes up
By BrianOK, with 3 replies.
Last reply by Xmin_Terminator, over 9 years ago:
I said I don't know much about greenfoot, and I just said danpost because he has helped me a lot, just trying to share what I know, sorry for what I got wrong.
356
357
358
359
360
361
362
X