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
Null pointer exception in making an actor point at another actor
By Drew, with 8 replies.
Last reply by danpost, over 12 years ago:
@SullyFish, you should avoid using 'Greenfoot.delay' in scenarios that require constant movement by actors. You will probably have to adjust your 'countdown' value to compensate. BTW, this discussion is two years old and there is now a 'turnTowards' method in the Actor class. Your 'pointAtObject' method can be written like this now: <Code Omitted>
How to stop an actor while letting the other actors keep moving?
By Discovery530, with 3 replies.
Last reply by Discovery530, over 12 years ago:
lordhershey wrote...
Do you want the actor to stop forever and just sit there? If so, just make a Boolean variable call it something like NeverMoveAgain, set it to false upon construction. When the edge of the world is detected set this variable to true. In the act have this <Code Omitted>
Pretty smart actually :) I'll try that when I get back on my program
danpost wrote...
If you use a World constructor 'super' call with only three int arguments, 'super(int, int, int)', then your world is
Starting the Game
By jmdreyer, with 5 replies.
Last reply by jmdreyer, over 12 years ago:
Thanks for all your help.
How to Shoot
By wasp1928, with 5 replies.
Last reply by danpost, over 12 years ago:
What is the class of the object that spawn the bullets? if it is an Actor object of some kind, what is its movement code, if it moves (which I presume it does)?
Making an actor unable to walk through other actors
By gamer121, with 6 replies.
Last reply by danpost, over 12 years ago:
gamer121 wrote...
Should the 'if (isTouching(Wall.class)) move(-2);' should go in the act method?
It could go after 'checkKeys();' in the act method; but, I think it might be better placed at the end of the 'checkKeys' method itself (below and outside the last 'if' block).
Trouble with Tic Tac Toe AI
By JasonZhu, with 2 replies.
Last reply by JasonZhu, over 12 years ago:
It's most likely in the checkForTwo(), the rest are seemingly functional.
How do you ask a user to type in his/her name in Greenfoot?
By BeYouself, with 3 replies.
Last reply by danpost, over 12 years ago:
That is the whole code, but if you want it in method form, it would be something like this: <Code Omitted>This method will return an empty String, or a String object of zero length, ( "" ) if the user is not logged in.
Kinect
By Alexander, with 1 reply.
Replied to by BeYouself, over 12 years ago:
http://www.greenfoot.org/doc/kinect
Why does the snake start as 6 squares instead of as 1 square?
By Tommy99, with 7 replies.
Last reply by patrick26, over 12 years ago:
'
Get an actor to change color
By anonymousse, with 58 replies.
Last reply by danpost, over 12 years ago:
Please refer to the middle section,
The condtional operators
, of
this page
of the Java tutorials.
Companion?
By SullyFish, with 1 reply.
Replied to by lordhershey, over 12 years ago:
You could try something like have the bat turn towards the player, Use a countdown variable that gets set when you turn towards the character and each act method minus 1 from it, when it reaches zero turn towards the player and reset counter, this would be kind of like a gnat buzzing around your guy. Is that what you are looking for?
Questions about constructor
By getreides, with 4 replies.
Last reply by getreides, over 12 years ago:
Ah yes indeed, thank you so much for your help! I might get back once more after having tried some stuff:
How does one make an actor move when another actor comes in contact with it?
By Arichman, with 1 reply.
Replied to by danpost, over 12 years ago:
I think what you have will move the balls when the robots touch them. They are just not moving in the way you would like. I believe you want the ball to move in the same direction as the robot touching it is moving (or facing). For one example method: <Code Omitted>
Object being erased and re-added
By WhiteWolf13, with 3 replies.
Last reply by davmac, over 12 years ago:
If you remove the object from one world and add it into the second, as danpost describes, it will retain all its variable values.
AI and Intersections (pacman)
By dangwang, with 1 reply.
Replied to by davmac, over 12 years ago:
You need to introduce an instance variable which tracks whether the decision for the direction has been made yet. Only choose a new direction if it is false. You will need to clear it back to false once your Ghost moves past the intersection.
687
688
689
690
691
692
693
X