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
[Ask] Rough Terrain Problems
By Zhirayuki, with 4 replies.
Last reply by Zhirayuki, about 13 years ago:
yes exactly... dunno the logic , anyway he didn't share the code
Odysseus Game Help
By tallyaka, with 2 replies.
Last reply by tallyaka, about 13 years ago:
Ok thanks! I wanted to put it in my actor so i fiddled with it a little, but thanks!
img help
By Tomc84, with 1 reply.
Replied to by DonaldDuck, about 13 years ago:
I don't know if I know what you mean but from what I see, you should be calling remove(Hollow) as you already have a reference to a specific object. Also, you can't change your hollow to a pow if you remove the hollow. It looks like you shouldn't remove the hollow, but change to Hollow.setImage("comicpunch.png"); so it changes the image of the object at the offset instead of the image of the current object.
Too many Datas
By Busch2207, with 2 replies.
Last reply by Busch2207, about 13 years ago:
That's a brilliant idea! It works perfekt! :D Thank you. I just have heard, that it needs longer, to load a byte variable, than an int variable. Is this true?
Help!
By Dom, with 35 replies.
Last reply by Dom, about 13 years ago:
THANK YOU SO MUCH! IT'S DONE!!!!! AFTER 3 HOURS, IT IS COMPLETE. YEAH! I listened to what you said, but instead of making the world bigger and adding walls as I don't know how to add walls, i simply just moved the platform away form the dge of the world. Thank you so so much!
Changing the image of Actors from inside the World.
By Omniscience, with 13 replies.
Last reply by danpost, about 13 years ago:
As I am not sure as to all the specifics of your scenario, it is hard to say how I would have done it. Do I understand correctly, that the images are changing size to make it appear they are getting closer (or farther) from the observer? If so, I probably would have three variables, two to hold the scale at full size (x and y) and the other to hold the current percentage of full size; then I would have seperate classes for Truck and Camel, putting a public method in the Truck class to call when the object needs swapped
One object "chasing" another
By tallyaka, with 8 replies.
Last reply by tallyaka, about 13 years ago:
Ok, it's working. I'm publishing my "so far" version go
here
to check it out! p.s. Thanks a ton! Never would have figured all that out on my own.
keyboard control
By Alfie5, with 4 replies.
Last reply by Alfie5, about 13 years ago:
Thank You
Can any one give me pointers* on cameras in java?
By Anthony_Tatowicz, with no replies.
So im trying to create some programs to use cameras, like a webcam or a kinect for many different reasons, but i have no idea were to start on even inputing/ getting data from the camera any help would be appreciated.
Making better pseudorandom numbers?
By Anthony_Tatowicz, with 17 replies.
Last reply by Duta, about 13 years ago:
Don't sweat it - everyone gets things wrong sometimes, don't feel like a jerk.
how to make ai check for more than one piece of cover?
By steven0784, with no replies.
i have a move method but i think i don;t know how to make it so that the soliders will check if there is more than one cover on screen private void move() { List b=getWorld().getObjects(NaziCover.class); int Distx, Disty; double angle; if(b.size()>0) { NaziCover B=(NaziCover)b.get(0); if (B.getUnderCover() <= 2) { Distx=getX()-B.getX(); Disty=getY()-B.getY(); angle=Math.toDegrees(Math.atan2(Disty,Distx))+180; //The next part of the code make the zombie move forward depending of his speed and direction angle = Math.toRadians( (int)angle ); int x = (int) Math.round(getX() + Math.cos(angle) * Speed); int y = (int) Math.round(getY() + Math.sin(angle) * Speed); setLocation(x, y); if(u == 1) { B.UnderCover(); h = 1; u--; } else { } } else { if( h ==1) { Distx=getX()-B.getX(); Disty=getY()-B.getY(); angle=Math.toDegrees(Math.atan2(Disty,Distx))+180; //The next part of the code make the zombie move forward depending of his speed and direction angle = Math.toRadians( (int)angle ); int x = (int) Math.round(getX() + Math.cos(angle) * Speed); int y = (int) Math.round(getY() + Math.sin(angle) * Speed); setLocation(x, y); } else { setLocation(getX() - 5, getY()); } } } } so how do i make it so they check for more than one piece of cover so that if one is full the other one will check if there is more cover instead of just moving left.
classes and methods
By Alfie5, with 4 replies.
Last reply by darkmist255, about 13 years ago:
Hmm... I must've missed something when I did my crab scenario (very likely), because I don't have an animal class anywhere :(. Sorry, but I would need to see what the animal class is to see why it doesn't like your code. Do you know if there's a download somewhere on the site to a completed crab scenario (I looked for a bit, but had no luck). If not, do you think you could post the animal class methods on this discussion?
New to Greenfoot, please help!
By Dave, with 15 replies.
Last reply by Dave, about 13 years ago:
The Menu now appears at the top left on my game screen =) I need to now try and add a help section inside the menu which includes instructions on how to play the game, figure out how to add another two levels which start after the level before is completed and some form of power up but don't worry I don't expect you to help me with that! lol Since I have started at my new college Greenfoot has not opened up ONCE on their computers even from the stand alone on my memory stick, this isn't just happening to me but it does work for most of the students there. That is why I am so grateful for a
How to get coordinates of List objects
By MattT, with 3 replies.
Last reply by Duta, about 13 years ago:
MattT wrote...
Unfortunately, I do not know how to run methods inside List objects. Any suggestions? Thank you. :)
Do you mean methods held inside Boat.class? If so, here's a code snippet demonstrating it: <Code Omitted>Where x is the boat's position within the list
java.lang.IllegalStateException: Actor not in world. An attempt was made to use the actor's location while it is not in the world. Either it has not yet been inserted, or it has been removed.
By TopInPut, with 7 replies.
Last reply by danpost, about 13 years ago:
Yes, only because there is no other code in the method. However, if more code was added later on, the if-else if statement would not prevent that code from executing, and would probably cause a run-time error (trying to do something to an object that is no longer in the world). Use of the 'return;' statement, especially after removing the object from the world, is more of a fail-safe.
1001
1002
1003
1004
1005
1006
1007
X