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
What's the meaning of this piece of code please?
By poila., with 1 reply.
Replied to by danpost, about 13 years ago:
The 'public static int FlysEaten = 0;' statement will be used to keep track of how many flies that ALL of your spiders have eaten. I believe the 'canSee(Class cls)' and the 'eat(Class cls)' are methods inherited from the Animal class. The 'canSee' will check for intersecting flies with this object, and if there are any, the 'eat' will remove one. Then the counter increments with 'FlysEaten++'.
Playing sound if not playing?
By nooby123, with 2 replies.
Last reply by nooby123, about 13 years ago:
Thanks!
playerdata
By tylers, with 1 reply.
Replied to by tylers, about 13 years ago:
well ive fixed it now (could be a bug) i closed the program and restarted it
colours
By tylers, with no replies.
how do you change the colours of the text on the score board?
Little Problem with drawing ...
By arialdancer, with 1 reply.
Replied to by danpost, about 13 years ago:
From the code you have given, it appears that all you see is the note. You can only set one image to each object (but different objects of the same class can have different images). You are creating the fiveLine image and setting it to the object, then you are creating the note image and now setting it to the object (which replaces your fiveLine image). I do not see where you 'addObject' the note object into the world. From your act() method (drawFiveLine(); drawNote();), it appears that you are trying to create two different objects with the same object class. If this is so, you need t
Explosion help
By jdemshki, with 7 replies.
Last reply by davmac, about 13 years ago:
Okay, nevermind; (it doesn't say the URL, it just shows how to get there). Yes, the video is old and out-of-date. But you can easily get the support classes at the URL I provided above. Also Greenfoot 2.2.0 will come with several support classes that you can import into your scenarios.
Quick questions
By woodkami, with 15 replies.
Last reply by danpost, about 13 years ago:
You can just change the '8's to 'getWorld().getWidth() - 1' or 'getWorld().getHeight() - 1' (depending) and it will work for any size board. I checked up on 'Go (board game)' on Wikipedia. The corners are safe and the edges are fairly safe; so, what I had prior to the most recent code post was more to the rules of the game. That is, for lines 19 through 22 above, you would use:
help with getting objects to move towards another object
By mrub4, with 1 reply.
Replied to by Cesarferreir, about 13 years ago:
import java.util.List; public int pointTo(int x, int y) { int dX = x - getX();//get distance between mouse's X and player's X int dY = y - getY();//get distance between mouse's Y and player's Y double rotation = Math.atan2(dY, dX); rotation = Math.toDegrees(rotation); return (int)rotation; } List<Worm> crab = getObjectsInRange( 2000,Worm.class); if(crab.size()!=0){ pointAtObject(crab.get(0)); move(6.0);}
scores
By tylers, with 4 replies.
Last reply by davmac, about 13 years ago:
"Help" -> "Greenfoot Class Documentation"
Quick query...
By Omniscience, with 1 reply.
Replied to by danpost, about 13 years ago:
No. That is not possible. Although, you could create a public method that will except a keystroke and store it for future use, if that is what you want. Why would you want to 'pause' the execution of the scenario and still allow keystrokes to be directed to it? Maybe(?) you did not explain what you wanted clearly enough and there IS(?) a way to do what you want.
Greenfoot Help Radius
By Moritz, with 5 replies.
Last reply by Moritz, about 13 years ago:
Ok it is running =) thank you - But there is still an other problem: When I want the snake to jump and I push the "jump key" two or more times while the snake is jumping for the first time, it also will jump two or more times after landing - also when I don“t push the "jump key".
keep getting an error message
By michelman, with 23 replies.
Last reply by michelman, about 13 years ago:
thanks! I did what you said and it now works. changed the getOneIntersectingObject method to the getOneObjectAtOffset method.
How to make something circle?
By kiarocks, with 8 replies.
Last reply by mik, about 13 years ago:
To answer your first question: You could use turnTowards and then turn(90). You would always move at a tangent...
mouse click question
By Tomc84, with 9 replies.
Last reply by mik, about 13 years ago:
A similar thing (changing the image by rotating through a set of different images) is explained in the
Joy Of Code, Episode 17
(towards the end). However, there it uses an if-statement instead of the modulo operator (%). The modulo operator is a little more elegant, using an if statement is (initially) easier to understand. The bit about changing images starts around 16:40.
Creating custom GIFs for Greenfoot??
By NJoson, with 17 replies.
Last reply by NJoson, about 13 years ago:
I agree with Morran. I like the interface of Gimp but learning to navigate through it can be hassle.
993
994
995
996
997
998
999
X