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
How to make a class the criteria for a method?
By Affan, with 1 reply.
Replied to by bourne, over 10 years ago:
First, getObjects returns a List which cannot be assigned to the variable actor of type Actor. Second, are you wanting something like this? : <Code Omitted>
getOneObjectAtOffset not working?
By VincentG, with 3 replies.
Last reply by VincentG, over 10 years ago:
I figured out what was happening, I miss understood getOneObjectAtOffset method. Thanks for the reply too :)
Steady image
By Chaveron, with 15 replies.
Last reply by Chaveron, over 10 years ago:
Yea sorry, I forgot that part. public void setLocation(int x, int y) { int width = getWorld().getWidth(); int height = getWorld().getHeight(); while (x >= width) { x -= width; } while (x < 0) { x += width; } while (y >= height) { y -= height; } while (y < 0) { y += height; } super.setLocation(x, y); } But I found my problem already. I just
change the order of acting objects
By Jtlie, with 1 reply.
Replied to by danpost, over 10 years ago:
You would have to link the pairs so that one 'knows' about the other. By their x locations and the direction of user input, you can determine which to move first. Move both at the same time (do not have both moved individually by their own act method calls).
zombie game
By jubyfollower, with no replies.
so ive plugged in a health for my player and i seems to work decently but when the zombie hits the player the health does not seem to go down? any ideas
Limit the movement of an actor
By Aaron91, with 1 reply.
Replied to by danpost, over 10 years ago:
This is just a matter of doing what you want: if the value of the coordinate is below the lower limit, set it to that lower limit; and, if the value of the coordinate is above the upper limit, set it to that upper limit
Cannot find symbol - method getWidth()
By shern91, with 14 replies.
Last reply by danpost, over 10 years ago:
You should probably review the Actor class documentation (double click on the 'Actor' icon) or use
this link
. See what methods are available to use in your Actor subclasses (besides those you may write yourself). Make use of them to get other objects you may want to run methods on.
Need help with GetObjectsInRange
By Rickboy26, with no replies.
So i got a Hero Actor (Garp), And a enemy (Gnomus) How can i let Gnomus follow garp trough the map? i got this <Code Omitted>
My for loops are ignored
By Vacrin, with 3 replies.
Last reply by Vacrin, over 10 years ago:
Thanks!
Problem with enemy
By Nooyi, with 3 replies.
Last reply by danpost, over 10 years ago:
The method you provided will return the correct boolean value. Your problem is elsewhere. You may have to show the entire class for help.
How to control external device?
By Yogibaer, with no replies.
Inspired by the scenario "pico board" within the documentation site I started a scenario to control the K8055D-Board of Velleman. The board is connected via USB and comes with a fully documentated .dll-file. The concerned uploaded scenario is "GF KD8055". The critical lines are put to comment in the moment. If they are activated it happens that: during compiling it says: no syntax errors; but it doesn`t come to an end and the word "Panel" doesn`t come. Due to this behavior the scenario can not be started. Hi, Michael Berry, or others please help kind regards Yogibear
Zombie game
By jubyfollower, with 2 replies.
Last reply by jubyfollower, over 10 years ago:
Alright Thanks :D i got it working!
Life Counter Aid
By GeicoCoder, with 1 reply.
Replied to by danpost, over 10 years ago:
'Lives': it is more of a game thing than a Ball or Mushroom thing; that is, it belongs more to the 'user' than to any specific object within your scenario. A mushroom or ball can be re-used or replaced so many times for the user. My point is that the field to track the lives should probably go in your world class. When no mushrooms (or balls) are in your world, you can decrease its value, check it for zero to perform a game over routine, and add a new one and adjust any actor that displays its value if not game over.
<identifier> Expected
By Mr.Murphey, with 3 replies.
Last reply by Mr.Murphey, over 10 years ago:
Thank you
give a object a number depening on where it spawns
By Jtlie, with 1 reply.
Replied to by danpost, over 10 years ago:
In the Krat class, add an instance field to hold that number you wish to give it <Code Omitted>Change the constructor to accept its new value: <Code Omitted>In the constructor, save the value: <Code Omitted>If you wish access to the value to outside classes, give the field a 'get' method: <Code Omitted> In your 'vuller' method above, you can then change line 11 to: <Code Omitted>That will give each one a unique number depending on where they spawn.
746
747
748
749
750
751
752
X