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
turning at a random angle between -45 and +45 degrees.
By Miguel.Valdez, with 5 replies.
Last reply by Miguel.Valdez, over 8 years ago:
Yes, oops I meant 90.... Nd ok I get you, this really cleared a lot up for me on new ways in how to use .getRandomNumber()
generating between two number ex: 8 - 10
By Miguel.Valdez, with 10 replies.
Last reply by Miguel.Valdez, over 8 years ago:
danpost wrote...
Miguel.Valdez wrote...
To understand is "(maxWorm-minWorm+1)-minWorm" doing this.... 12-8=4+1=5+8=13? So the max number will be 12 because 13 is excluded... But how is 8 the minimum?
12 - 8 + 1 = 5 :: the number of choices. The random number generated will be in the set { 0, 1, 2, 3, 4 }. Any one of these values plus the minimum value, 8, will produce a value in the set of numbers, { 8, 9, 10, 11, 12 }.
this answers my other situation than for the angles!!!! i will post on that topic.
Help with flipping an image
By emystery, with 3 replies.
Last reply by emystery, over 8 years ago:
nevermind i ended up fixing it <Code Omitted>
Mutiple Clicks On Mouse
By MichaelMac, with 4 replies.
Last reply by danpost, over 8 years ago:
Agent40 wrote...
I believe that he's trying to ask for some code that checks whether or not LMB and RMB are active at the same time.
If that is the case, using the
mouseClicked
method will not help in determining the down state of the buttons. Also, since only one button's action can be returned on any given act cycle, it would be very difficult to devise code that is guaranteed to work. For example, if both LMB and RMB changed states during the same act cycle, one of the buttons will not be shown to have done an action (although both actions may be detected -- this I am not su
Pinball game
By arthurmadson, with 1 reply.
Replied to by danpost, over 8 years ago:
So far as I can see, the ball only has vertical movement; and even then, that which is unregulated -- there is no implemented collision detection in the class. You will probably need not only to show what codes you currently have in the
paddle
class but also that of your
actor
class.
Variables not resetting when senario stopped, reset then run
By Code8Paramedic, with 1 reply.
Replied to by danpost, over 8 years ago:
The
static
fields are created when the project is compiled. You can only "reset" them using program code between compilations. Note that resetting a project does not recompile it. I doubt seriously, however, that any of the fields in your
MyWorld
class should be
static
ones. You should not make a field
static
just to make it easier for other classes to access it. If you had two MyWorld objects side by side (pretend you had two of your games running), would you want them both to always be on the same level or always share the same score? Of course not. You wou
How do I add an actor based on the score?
By UnKnown89, with 19 replies.
Last reply by UnKnown89, over 8 years ago:
I know that I am very bad at greenfoot but thanks soo much it works now. Thank you very much
getting random number
By Miguel.Valdez, with 4 replies.
Last reply by Miguel.Valdez, over 8 years ago:
I did but did not take into consideration the exclusive part. So what my professor said was wrong.
How to let a actor walk?
By LMT, with 5 replies.
Last reply by danpost, over 8 years ago:
Yehuda wrote...
Right when I saw the answer was "Yes" I understood. Because I've seen before how all brackets are removed if they're not between the code tags. Now that can make sense (although it always did).
Lol -- I realize now that my copy/paste operation before editing the line also did not get the array brackets. My edited line should read: <Code Omitted>
My bullet code is not working
By mountwo22, with 6 replies.
Last reply by mountwo22, over 8 years ago:
Thank you so much
Adding and removing object with the same button.
By Recorsi, with 2 replies.
Last reply by Recorsi, over 8 years ago:
That is the problem i had. Thank you :)
null pointer exception
By LobsterL, with 2 replies.
Last reply by LobsterL, over 8 years ago:
Thanks you
Calling World public method with actor as a parameter
By FabioPacheco, with 25 replies.
Last reply by danpost, over 8 years ago:
FabioPacheco wrote...
But I still have the problem with: <Code Omitted>The "new ActorIcon" doesn't accept the variable violin It says that "cannot find symbol- variable violin"
Where did you try to use this line of code? You will need to remove at minimum in your MyWorld class lines 6, line 51, lines 132 through 152 and lines 170 through 190. Then line 89 will need to use my example code for adding the Viiolin object. The other objects (Tambourine, Mandolin, Congal and Saxophone) should be added (at lines 77, 81, 85 and 93) similar to that o
Why doesn't setLocation work?
By Recorsi, with 5 replies.
Last reply by Yehuda, over 8 years ago:
Before we fixed the problem, every act cycle that a laser was touching the Actor that the getHit method is in, 1 would be subtracted from ‘health’. Now that each bullet only remains for one cycle, it only subtracts 1 from ‘health’ in its lifetime.
Enemy turn towards you and shoot...
By Timmy_11, with 2 replies.
Last reply by Timmy_11, over 8 years ago:
Thanks I'll try it out
275
276
277
278
279
280
281
X