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
MiniMap help
By Trystar360, with 3 replies.
Last reply by danpost, about 9 years ago:
Oh, I see. You need to retain the base image (one without any dots) and make copies of that and add the dots to each copy to be set as the current image. So, <Code Omitted>
getObjectsInRange help?
By cococypress21, with 1 reply.
Replied to by Super_Hippo, about 9 years ago:
The getObjectsInRange method returns a list, not just an actor. You can use a for-each to go through the list. <Code Omitted>
Remove a class and use an other class to do her job
By Phirippu, with 4 replies.
Last reply by Yehuda, about 9 years ago:
Problem 1: For the Paddle to be removed you need the ball to be touching the paddle when s == 48. If you want to remove all the paddles from the world (which will remove the one that's there), then you can do the following: <Code Omitted> Problem 2: I can't help with what's happening with the Paddle2 with the code you gave, you need to show the full Paddle2 class code.
Start screen not working
By SebiRaul, with 2 replies.
Last reply by SebiRaul, about 9 years ago:
Aah, I completely forgot about the act method. Thank you so much :D.
Why won't my scenario run?
By SilentScoper8, with 1 reply.
Replied to by danpost, about 9 years ago:
Fact 1: an actor must be created prior to it being placed into a world Fact 2: the constructor of an object is executed at the time the object is created This being said, 'getWorld', when used in the constructor of an Actor subclass, must return a 'null' value. Line 15 of the Score class constructor sets 'null' as the value of the 'world' variable. Then, line 16 and 17 tries to call the 'getP!score' and 'getP2score' methods on that 'null' value. Hence, the 'NullPointerException' error you were getting. You could make use of the 'addedToWorld(World) method of the Actor class, which is
Remove an actor from the World class
By JonahZW, with 3 replies.
Last reply by danpost, about 9 years ago:
There is no code to add a ball into the world (nor created). So 'myBall' is never assigned any Ball object that can be removed.
Counter to 9 To change a new world
By GrowlerGaming, with 1 reply.
Replied to by danpost, about 9 years ago:
GrowlerGaming wrote...
I am trying to set my code up so that when all _Goldballs are gone that It sends the user to Level02.
I am not sure what 'Counter' would be, either. But, it sounds like all you need is the following for line 3 <Code Omitted>
Use a public variable in an other class
By Phirippu, with 3 replies.
Last reply by Phirippu, about 9 years ago:
Thank you danpost, it is working :)
ThreadAct
By MrBradley, with 7 replies.
Last reply by MrBradley, about 9 years ago:
Davin, Thanks for the feedback. I will use a Producer/Consumer model for the message pump approach. I always try to design and build solutions that can be used as a learning opportunity for my students. In the example above I have stripped away all of the unnecessary elements to focus on the pause between actions. I still need to ensure that the pause will work across multiple actors to solve the long running (aggregate of primitives actions) method calls. On another note: Any plans to change Actors from a class to an interface? ;)
how to add a counter
By LeoJC, with 1 reply.
Replied to by danpost, about 9 years ago:
Please check out my
Value Display Tutorial
scenario for information on adding a counter to your world.
Moving Background
By DustTerminator, with 1 reply.
Replied to by danpost, about 9 years ago:
Please check out my
Scrolling Tutorial
scenario for information on making a scrolling world.
Where is my error
By asmith1998, with 1 reply.
Replied to by Super_Hippo, about 9 years ago:
Change the 'if' in line 55 to 'else if'. In the future, please provide the error message, so we don't have to guess what could be wrong. Btw, 'this' will never be 'null'.
Selecting units via a box
By LichKing, with 1 reply.
Replied to by danpost, about 9 years ago:
In my Conway''s Game of Life scenario, I implemented something similar to save an area of the grid. I had these parts: (the following maybe would be in your World subclass)
Calling a method from the World Class
By NickWood18, with 1 reply.
Replied to by danpost, about 9 years ago:
By 'call a method from the World class', I think they mean 'call a method that is defined in the World class'. The 'showText' method is defined in the World class. You can have your World object call it: <Code Omitted>or have an Actor object that is in the world call it: <Code Omitted>
Condensing multiple classes into one
By JeSuisFish, with 3 replies.
Last reply by danpost, about 9 years ago:
You just need an identifier in the combined classes (Tank, Turret and Shell) -- probably an int field to distinguish one from another (using values from zero to three). Add methods to the classes to return the identification number so that other objects can determine which they are.
342
343
344
345
346
347
348
X