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
Play sound when an object touch another.
By LaurentiuRohan, with 3 replies.
Last reply by danpost, almost 10 years ago:
Nosson1459 wrote...
You can do: < Code Omitted >
Lines 1 and 2 in the code provided by Nosson1459 must be declared outside of the method; otherwise, a new sound will be created and played for each act cycle that the actor is touching the button.
Placing Objects
By BrownDwarf, with 8 replies.
Last reply by danpost, almost 10 years ago:
BrownDwarf wrote...
How do I add an object to a list?
See
here
.
second world?
By StarterCreator, with 6 replies.
Last reply by Nosson1459, almost 10 years ago:
getWorld returns the world that the actor that the code is running from is currently in, I don't think you can get any other world, so the addObject will add it to the same world. (Not arguing with danpost just saying it in my own words)
java.lang.NullPointerException error
By FunTHX200mc, with 1 reply.
Replied to by danpost, almost 10 years ago:
Switch lines 44 and 45. You need the actor in the world when you call the 'lovit1' method.
Algorithms
By Hondrok, with 3 replies.
Last reply by Hondrok, almost 10 years ago:
Nosson1459 wrote...
See
this: https://docs.oracle.com/javase/tutorial/collections/algorithms/index.html
.
Super_Hippo wrote...
Algorithms are like a step-by-step manual to reach a goal from a defined start position. You could even count the following as an algorithm: Situation: You have dirty hands. Goal: You want to have clean hands. Algorithm: As long as your hands are dirty -hold your hands under water for 10 seconds -use soap and wash your hands for 30 seconds
thank youuu
Help with MouseClicked, emergency
By HardToFindAName, with 24 replies.
Last reply by Super_Hippo, almost 10 years ago:
You're welcome. Good luck ;)
Numbers smaller than 1
By Nooooob, with 1 reply.
Replied to by danpost, almost 10 years ago:
Nooooob wrote...
Can you use numbers smaller than 1?
Not unless the field ('length', in your case) is of type
double
or
float
(not
int
), or your unit of measure for 'length' is changed (instead of units, you assigned -- virtually --, say, 1/100th of a unit as the new unit).
How to change an actor's image directly from the world?
By EdiPosteuca, with 2 replies.
Last reply by danpost, almost 10 years ago:
Please show the code used to declare and fill the array and explain, in detail, what each part in the array is for (what the positions in the array represents and all values within the array). Then show the code for the 'for' loop that you have tried. If there are any unknowns within the codes given, explain what they represent.
Greenfoot crashes when program is run with certain actors
By M0N57R0517Y, with 6 replies.
Last reply by danpost, almost 10 years ago:
Any variables that need to be maintained through multiple act cycles must be declared outside of any methods. That means lines 24 through 29 and what you have inside the 'Info' method (line 15). You can remove the 'pause' method as the timer will take care of that part. Instead of 'Info' as the name of the field that determines what needs done, I would use something more meaningful -- like 'step'. You can declare constants (outside of any method) to help in what step is what. For example:
Help in making a platformer game?
By haynako, with 4 replies.
Last reply by Nosson1459, almost 10 years ago:
Is there a way that I could have found the above link (
here
) on my own, because I have never saw it before until now and it would have helped me (I'm also wondering if there are other things there that I haven't seen).
How can I make a screen-shake effect?
By Gormatrax, with 1 reply.
Replied to by danpost, almost 10 years ago:
The code that you would use to make the screen shake is basically the same as what you would use to make the world a scrolling world. The only differences are (1) the scrolling is limited to very short distances (vertically and/or horizontally); (2) what condition(s) are used for scrolling; and (3) the behavior of the scrolling. The third difference is really a result of the second one.
Shaking the world is now included in my
Scrolling Tutorial
scenario and is demonstrated in my
Scroll
@danpost I need help...
By Kokoro, with 2 replies.
Last reply by Kokoro, almost 10 years ago:
Yeah i manged to noticed that like after i posted this :D However it worked thanks !!
Greenfoot doesn't start
By Sirgeorges, with 2 replies.
Last reply by Sirgeorges, almost 10 years ago:
Thanks man, nailed it.
How to make actor stop
By Nooooob, with 6 replies.
Last reply by Nooooob, almost 10 years ago:
danpost wrote...
It means that it does not like that line there. Move it up -- outside the 'act' method (but, still within the class).
I see. Many thanks for your input !
How Do I Change Value Of Actors(cards) Based On Previous Actor Selected?
By zanzabarjones, with 1 reply.
Replied to by Super_Hippo, almost 10 years ago:
Let's say you have one class Card. And each different card is represented by a different 'type' value. For 5 cards, these values would be 0-4. If you press a card with type 3 and then one with type 2, it will add a certain number of points. The next card's previous is 2 then. The array could look like this:
395
396
397
398
399
400
401
X