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
This line of code doesn't work with no explanation.
By RussellBlo, with 2 replies.
Last reply by danpost, over 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, over 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, over 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, over 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, over 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, over 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, over 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, over 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, over 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.
Method to other class?
By Weetis, with 1 reply.
Replied to by danpost, over 10 years ago:
There are two possible errors that you could be getting on line 10 -- it would have helped if you explained what error message you were getting there. The first is the image filename -- image filenames usually end with 'png' or 'jpg' ( 'pjg' is not a normal image filename suffix ). The other is that a non-static method cannot be called from a static context. This means you need an object of the class to call the method on (you cannot call the method directly on the class name). Finally, there does not appear to be anything wrong with line 4 -- again without you being more specific, one can
A beginner for help
By beyond, with 1 reply.
Replied to by Boogabacon, over 10 years ago:
What do you mean, do you want to add a raspberry? Marry me?
Make an object go away after a certain time
By Bassusour, with 7 replies.
Last reply by Super_Hippo, over 10 years ago:
Bassusour wrote...
But how do I introduce an instance timer field?
<Code Omitted> And then, to increment it in the act-method: <Code Omitted>
Access Methods From an Different Actor
By Hydrowarrior, with 1 reply.
Replied to by danpost, over 10 years ago:
I have yet to look at your video; but -- why would you edit the Mover class at all? I do not think it was intended for that. At any rate, I will look at the video to see what there is, EDIT: I do not think the method should be there, anyway -- it should probably be in your World subclass.
Make an actor rotate around another actor
By Cameronte10, with 5 replies.
Last reply by danpost, over 10 years ago:
I would guess that the distance you are moving the enemy is not enough to change the angle by a full degree, so it moves back to where it started. Try increase the speed from 'move(1)' to something higher.
Book 2nd edition p. 9 concept
By keizerbob, with 5 replies.
Last reply by danpost, over 10 years ago:
Okay. I see what you are saying. The margin text does say that the return type is part of the method signature; when it is actually not part of it. The main text along side it also implies that the return type is part of the method signature. It is given as part of the method description in the object menus provided by greenfoot; but, again is not actually part of the method signature. So, yes -- a correction in the book should be recommended.
490
491
492
493
494
495
496
X