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
Error: n must be positive
By Pe1per, with 7 replies.
Last reply by davmac, over 10 years ago:
Super_Hippo wrote...
How is 350-250= -100?
Hmm, you're right. I mis-read that code (as 250 - 350). However, the 'n must be positive' error nearly always comes from mis-use of the Greenfoot.getRandomNumber method, in my experience (and it certainly doesn't come from addObject). Pe1per, perhaps you can point out which line actually causes the error rather than forcing us to guess?
Press a button while Game is over problem?
By AnthonioBanderas, with 1 reply.
Replied to by Super_Hippo, over 10 years ago:
Are only enemies moving? I think I didn't really get the way the game works right now. You get points for every click on an enemy and you have to place them back until one reaches the right side? Could it be that the seeLocation method (which I don't really understand why it is made like this) is quite useless? It is only called when it was dragged to a different position and if it is on a target position, it shouldn't move. How is this supposed to be? You could do it like that:
I dont want to press 2 buttons at a time
By Moho, with 3 replies.
Last reply by danpost, over 10 years ago:
For continuous: <Code Omitted>
trail following player
By Moho, with 1 reply.
Replied to by danpost, over 10 years ago:
<Code Omitted>or <Code Omitted>
Need Help ASAP
By n1nikko, with 1 reply.
Replied to by Super_Hippo, over 10 years ago:
Use the code tags to post code please. What I would suggest first, because this code is a mess (and it isn't easy to get an overview of what is important and what not), have the images in arrays. Then you can code that in a few lines and don't have to do something like what you did there.
Is this code correct for having an enemy moving left to right in my maze?
By pingster, with 2 replies.
Last reply by pingster, over 10 years ago:
Firstly thanks for the reply . Could you possibly give me a suggestion of what the code in line 3 and 6 needs to be?
Help With My 'Game Over' after HealthBar is Empty
By Manda_x, with 4 replies.
Last reply by Manda_x, over 10 years ago:
thanks its works now, you've been a great help to my game.
Array Problems
By xJesterPROx, with 7 replies.
Last reply by xJesterPROx, over 10 years ago:
In your second Demo, can you explain to me how the tail knows how to follow the head? I would post the code that covers things like direction and spawning the tail is almost the entire snake class.
Any ideas?
By pingster, with no replies.
Has anyone got any ideas about what to put into a maze game? Thanks
Slight Problem Getting Counter To Work
By Manda_x, with 13 replies.
Last reply by Manda_x, over 10 years ago:
thank you guys its now working
Boolean for sensing objects on one side?????
By DiplomatikCow, with 9 replies.
Last reply by danpost, over 10 years ago:
You should be able to use code similar to the code of the act method except that you will reverse the direction of the turns and look for walls instead of looking for where walls are not. This should be done once, when the actor is added into the world (use the 'addedToWorld' method).
How can I test the performance of the game?
By EnderPicture, with no replies.
http://www.greenfoot.org/scenarios/13054
question about calling a uni variable
By Socrates, with 1 reply.
Replied to by danpost, over 10 years ago:
How is the variable declared? and what is the name of the class it is declared in?
Keep Integers or Booleans When A New World Is Created
By Space0fAids, with 3 replies.
Last reply by danpost, over 10 years ago:
Maybe you should look at my
Super Level Support Class
scenario. It would facilitate in both retaining field values between worlds as well as changing from world to world. Although that scenario creates new worlds instead of returning to previous world, it can still be used. Create a static map (or array of levels) with static fields to track the world currently in and add a static method to change worlds using changes in location within the array:
The actors are spawning twice
By Pe1per, with 12 replies.
Last reply by Pe1per, over 10 years ago:
ok thank you all you really helped me :) Now it works fine!
606
607
608
609
610
611
612
X