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
ScrollWorld and GifImage
By MNastasi, with 2 replies.
Last reply by danpost, over 9 years ago:
MNastasi wrote...
How do you import the ScrollWorld and GifImage classes?
The GifImage class can be imported by using the menubar with "Edit>Import class...", selecting the class and clicking the "Import" button. For classes that are not listed there, you will need to download a scenario that contains it. After opening said scenario, you can close it right back up. Then use your windows explorer to select the "ScrollWorld.JAVA" class from that projects scenario folder and copy/paste it into the 'Greenfoot/lib/greenfoot/common' folder. Then it will also be available to import the sam
actor cannot be added into world
By FutureCoder, with 7 replies.
Last reply by FutureCoder, over 9 years ago:
Thanks, it all works now
Changing the image of the Actor when losing health
By KrystalLo, with 40 replies.
Last reply by danpost, over 9 years ago:
KrystalLo wrote...
It's working now! Thank you so much Dan!
I did not get to the last change that could be done to the Bomb class. You can also remove the 'wasITouched' method from the class.
Score table problem
By Juwen, with 3 replies.
Last reply by danpost, over 9 years ago:
Like I said before, I doubt you will want to use the UserInfo class (it is basically broken now anyway); and the Saver class is not needed. What is needed is for you to create a Score object and keep a reference to it in your World subclass. You can also add a method to the class to 'get' the Score object created. Then, the Timer class can get the Score object from the world and set the appropriate times using the 'setScore' method -- one call for each score to be saved.
Checking if there is an actor is at a specific spot in the world
By bleeblob43, with 2 replies.
Last reply by danpost, over 9 years ago:
Instead of adding and removing the Ground objects, you could just have them move themselves when the player is out of range to a new location along the same horizontal or vertical to the next non-ground location (like leap-frogging). To do that, you could have something like the following method in the Ground class called last from its act method:
At World Edge
By ssenese19, with 5 replies.
Last reply by danpost, over 9 years ago:
Well, in order for that to compile (so you could see what behavior you have achieved), the line would need to be changed to this: <Code Omitted>
Saving specific coordinates of a moving object
By SweetCaroline36, with 3 replies.
Last reply by danpost, over 9 years ago:
SPower wrote...
If you only want one pair of values for x,y to be saved, you can create two instance variables: <Code Omitted>
With this, you can use 'getX()' and 'getY()' to set the values of 'x' and 'y' when a button is clicked: <Code Omitted>
can't play any game
By Mikee, with 4 replies.
Last reply by danpost, over 9 years ago:
As far as running scenarios on the site, what do you see on the left below the description of the scenario. Do you see any evidence of an applet?
Platformer Floor Code not working
By RussellBlo, with 5 replies.
Last reply by danpost, over 9 years ago:
SPower wrote...
There is no method getWidth (or getHeight for that matter) for Actors. You'll have to use getImage().getWidth().
That was a slip. Actually, it should be 'floorObj.getImage().getWidth()'. I have been around long enough to be aware that at one time you could call those methods, 'getWidth' and 'getHeight', directly on the Actor object and do catch myself still trying to do that occasionally.
Scenarios will not run
By sengst, with no replies.
Whenever I try to get a scenario to run on the greenfoot website, it shows an error saying Your Browser is ignoring the <Applet> tag. Any ideas as to how to fix this?
Actor direction, and projected objects
By Ishimwe, with 1 reply.
Replied to by danpost, over 9 years ago:
Ishimwe wrote...
My actors image is always facing the right, how can I make it face the left everytime I press the left key? Also, my actor projects objects (laser beams) how can I make these beams go away when the hit the world edge?
Please show the code for this actor -- and for the laser beams.
help with getOneIntersectingObject
By Meh, with 8 replies.
Last reply by Meh, over 9 years ago:
ok thank you
Need help with calculating percentages in status bars
By Drvagax, with 1 reply.
Replied to by danpost, over 9 years ago:
Provided that you did not change anything at all in the 'toonConditions' method and the status bar was indeed working, then the only thing that could influence the status bar from in the QuokkaModel class is the 'getHealth' method. Where is it code? However, it is yet beyond me how the status bar could possibly work with the given code. The thing is that I cannot see how the bar would decay because it looks like you are filling a smaller rectangle over the full rectangle -- which would not actually change the appearance of a full status bar.
getHeight doesn't work
By grizzly1, with 1 reply.
Replied to by danpost, over 9 years ago:
Your actor does not have a height (or width) -- but the image of the actor does. Use 'getImage().getHeight()'. You could, although I would not, give the actor a height and a width if you wanted to by adding the following methods to the class: <Code Omitted>
Help with accessing functions between actors
By Sammi, with 4 replies.
Last reply by danpost, over 9 years ago:
I just noticed your subsequent post above (the one immediately following your initial post). The scoreboard does not need to see the horcrux. Remove lines 4 and 5 from the 'act' method of the ScoreBoard class (as shown above). Then change the name from 'act' to 'updateImage'. Finally, change the 'addScore' method to this: <Code Omitted>Also, you should have a constructor for the class (to set the initial image): <Code Omitted>Now, let me understand what you are trying to do in the
457
458
459
460
461
462
463
X