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
At World Edge
By ssenese19, with 5 replies.
Last reply by danpost, over 10 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 10 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 10 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 10 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 10 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 10 years ago:
ok thank you
Need help with calculating percentages in status bars
By Drvagax, with 1 reply.
Replied to by danpost, over 10 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 10 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 10 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
What is the most efficient way to transition background screens?
By ssenese19, with 2 replies.
Last reply by ssenese19, over 10 years ago:
Thanks! Very helpful @danpost
Health
By Walker, with 1 reply.
Replied to by Super_Hippo, over 10 years ago:
The class name should start with an uppercase letter. So change 'health' to 'Health' although 'Healthbar' would be better. <Code Omitted> In the loseHealth-method, you could add the following line (before the call to the update-method) to decrease the health: <Code Omitted>
Reset a game
By Dora, with 2 replies.
Last reply by Dora, over 10 years ago:
thanks a lot
Help with Educational Project
By chickenugget, with 1 reply.
Replied to by danpost, over 10 years ago:
Buttons should remain fairly dumb in that they should only react to mouse actions, if anything -- altering their image depending on what the mouse is doing (mouse hovering state or mouse button pressed state). The world is what should control the main actions of the simulation -- checking for clicks on buttons currently in the world and responding to them. The world should also hold a reference to the correct button that answers the current question. Let us say you have a Text class whose objects can display the questions as they are posed and a Button class whose objects can display the
How do I get the width of a particular world
By jeffcia, with 4 replies.
Last reply by jeffcia, over 10 years ago:
Thanks, Dan!
459
460
461
462
463
464
465
X