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
Teach Greenfoot to Y7's or Y8's
By moonandi, with 2 replies.
Last reply by moonandi, almost 10 years ago:
no we call it secondary school. I live in the UK
How to get Actor that is not in the world to stop running code
By Hydrowarrior, with 1 reply.
Replied to by danpost, almost 10 years ago:
Okay -- you have two methods, 'collide' and 'bottomOfScreen', that each require that the actor be in a world (and each which could remove the object from any world it might be in). A sure fix would be to add the following line as the first line in both methods: <Code Omitted> By the way, line 22 is not needed as there is no code that needs to be avoided after it (the method ends there and execution will return, anyway).
if confirmation dialog = something...
By AdamMyczkowski, with 4 replies.
Last reply by AdamMyczkowski, almost 10 years ago:
Oh sorry I didn't mean to include the string in this code, I tried method with an input before and forgot to delete the 'string'
How to fix unreachable statement error, and have boolean return true??
By KeithM, with 4 replies.
Last reply by danpost, almost 10 years ago:
Replace lines 70 through 73 with the following: <Code Omitted>This should not really change anything from the code it replaces; but, if ever a Food object is removed, which you seem to indicate happens with "When <such-n-such>,
then
the food is never removed...", the method must return a true value. All this is rather immaterial, as the value returned is not used through the call to the 'eat' method. That is, line 15: <Code Omitted>calls the method, but ignores totally any returned value.
Execute another program with argument from java
By vicbuenaventura, with no replies.
Hello, I'm using Greenfoot on Mac OSX as user interface to open another program (the program is called CLIPS expert system). I'm able to do it with the following code: <Code Omitted> But I also want to pass an argument in the form of a batch file (entitled "runfile.txt") so that when CLIPS opens, I want it to automatically execute the commands I've written in the batch file (such as loading a construct from a file, resetting, running, and exiting CLIPS). I tried the following code but it did not do anything: <Code Omitted> Additionally, I tried the following code and it did not do anything either: <Code Omitted>Does anyone know how to code what I'm trying to accomplish? Thanks, Vic
Trying to remove an object
By GreenMan15, with 2 replies.
Last reply by GreenMan15, almost 10 years ago:
Wow can't believe it was a small thing like that. Thank you
This line of code doesn't work with no explanation.
By RussellBlo, with 2 replies.
Last reply by danpost, almost 10 years ago:
RussellBlo wrote...
I have the List code there because I was getting the NullPointerException when I tried to check getIntersectingObjects code.
Maybe you should show how you tried without the List code since it probably is not needed to begin with.
How to know if one object can move?
By Dino.Chia, with 2 replies.
Last reply by Dino.Chia, almost 10 years ago:
Ok, I just realized that interrupted() its not a method xD, so the question is, what do i put inside interrupted?
How to make a "bullet" fire in a certain direction
By Sacramor, with 1 reply.
Replied to by danpost, almost 10 years ago:
Set the direction of the bullet when you create it in the class of the character: <Code Omitted>The last line is not absolutely necessary; I find that often, when one actor creates another one, the spawned actor is not always placed at the same location as the one that spawned it. Moving the bullet a bit gets it to start slig
Scoreboard will not work!
By browny87, with 4 replies.
Last reply by danpost, almost 10 years ago:
I was just about to edit my post and ask you to show the 'prepare' method of your GameScreen class. It seems I was on the right path. Glad you fixed it.
How to add a certain number of objects?
By heitorpereira, with 1 reply.
Replied to by danpost, almost 10 years ago:
I think you are confused as far as what input method you want to use. Either use a Scanner method or a JOptionPane method. The JOptionPane method 'showInputDialog' returns the value input as a String object and must be captured: <Code Omitted>This string value must then be converted to a number type value to be used as the limit in the 'for' parameter.
creating walls
By 103200, with 1 reply.
Replied to by danpost, almost 10 years ago:
First you need to show your subclass of Actor that will create the objects representing the walls.
Scoring
By lexboy112333, with 5 replies.
Last reply by lexboy112333, almost 10 years ago:
Thank you. It helped me a lot.
Set certain image when an actor is not moving
By God, with 1 reply.
Replied to by danpost, almost 10 years ago:
You can change 'if' to 'else if' on line 15 and just use 'else' on line 20 (remove the following 'if' statements and just execute the 'setImage' command.
Editor Problems
By Toly, with 1 reply.
Replied to by danpost, almost 10 years ago:
Toly wrote...
For some reason when I put in "if (atWorldEdge())," it tells me that it can't find a symbol. Anybody know what to do?
Maybe you got the name of the method wrong. You should check the
Actor class API documentation
to verify this.
488
489
490
491
492
493
494
X