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
cannot find symbol - method addObject (...)
By smcgee, with 12 replies.
Last reply by smcgee, almost 11 years ago:
danpost wrote...
The method 'getWorld' returns the World object that the actor is in (whatever AngelOfDeath object the act method is executing for). The 'addObject' method is then executed on that returned World object. This is similar to how the 'removeObject' method is used in lines 72 through 74.
Super_Hippo wrote...
I think 'Super Class' is the wrong word. 'getWorld' gets the world in which the actor is (or 'null' if it isn't in a world. Then this code would give an error). 'addObject' is a 'World' method and since the world in which the actor is in, is a subclass of 'World', it ca
Halp.
By A2O, with 3 replies.
Last reply by A2O, almost 11 years ago:
Sorry for swearing :c
Getting and Setting a variable- help
By carrotcarrot, with 2 replies.
Last reply by carrotcarrot, almost 11 years ago:
Thank you!
Can't run scenarios. "Your browser is ignoring the <APPLET> tag?"
By Entity1037, with 2 replies.
Last reply by malikdon, almost 11 years ago:
I added the site to my list and still can't run the scenarios in the brownser.
Randomly adding food to my world at random times.
By Poland, with 5 replies.
Last reply by danpost, almost 11 years ago:
Poland wrote...
It's for a class project. I'd rather not plagerize. But I suppose researching is fine.
I have come across other ways of making the snake body play "follow the leader" more recently which are actually a simplified way of doing it. Although the method behind the behavior is not an accurate representation, it still appears to behave similarly. One method involves creating a body part every time the head moves, giving that new body part a timer value to represent how long it will remain in the world. The more body parts you have, the higher the initial timer value.
Incompatible types
By Josh_H, with 4 replies.
Last reply by danpost, almost 11 years ago:
Well, I guess it is explained best in the java tutorials.
This page
says the following about classes that wrap a primitive value (Number subclasses):
Often, the wrapping is done by the compiler—if you use a primitive where an object is expected, the compiler boxes the primitive in its wrapper class for you. Similarly, if you use a number object when a primitive is expected, the compiler unboxes the object for you.
Problems with getting the image name
By Josh_H, with 1 reply.
Replied to by danpost, almost 11 years ago:
The 'getImage' method returns a GreenfootImage object, not a String object. If you want to track which image is current for the actor, you will need to keep a reference to what GreenfootImage you set to the actor. This can be done by having a field hold a reference to the image itself (as a GreenfootImage object) or, if you number the images, it can be stored as an int value. If only two possible images are used, a boolean value could then be used.
Tron Game Need Help
By aang.18, with 1 reply.
Replied to by ElNo, almost 11 years ago:
I hope that I'm understanding your question right, as it is a bit hazy... 1) As I understand you try to stop the game if there is a collision. Possible solutions: a) If you don't need the return value outside of your method collide and this test is just to determine whether to stop the game or not, you can simply change your type of return value to void. If there is no collision the method does nothing at all after checking for a collision. If there is a collision you can call the Greenfoot.stop() method. b) if you need the return value outside of the method collide you can integrate the
Compare a picture with another
By Ludmuterol, with 4 replies.
Last reply by danpost, almost 11 years ago:
Ludmuterol wrote...
must i import something?
You will either need to add the following at the top of the class: <Code Omitted>or change line 1 to: <Code Omitted>
I have found a serious glitch involving loops
By Poland, with 4 replies.
Last reply by Poland, almost 11 years ago:
Thanks, but it was a glitch. I restarted the program and I got it to work. This is what I ended up with: <Code Omitted>
Gun problem help
By jasper079, with 4 replies.
Last reply by danpost, almost 11 years ago:
Actually, you do not need a 'move' call there in the 'fire' method unless you want to have the initial location of the bullet at the end of the barrel of the weapon. The code given is representing the instance in time that the bullet it added into the world. The moving of the bullet will, or should, occur on upcoming act cycles by way of the class that creates it where 'move' should be called from the 'act' method. Now, if that class does extend the Mover class, then the issue may be what the values of 'movement' are set to (if they are zero, then, of course, the actor will not move).
i need help, make police cars try to ram you to the side of the road
By AngelusNeko13, with no replies.
okay guys i really need your help, im doing the finishing touches of Street Racer X, i dont know how to make police cars try to ram you to the sie of the road while driving the same speed as you, also i already made a class to make them able to crash into traffic and the side of the road, what im saying is there a way to make police class chase you while bumping into you try not to hit anything but also you can bump into them? i have the vehicle parent class made, i just need to know how to make a subclass do this, also can you give me and example naming the class police? heres my coding for the parent class of the traffic and bumpercar class <Code Omitted>and this is the bumpercar class here: <Code Omitted>heeeelp please :(
Writing Code for Tron Game
By aang.18, with 11 replies.
Last reply by ChethanU1, almost 11 years ago:
void populate(){ Actor0 c = new Actor0(); addObject(c, 1, 1); Actor1 w = new Actor1(); int r3, r4; for(int i=0; i<3; i++){ w = new Actor1(); r3 = Greenfoot.getRandomNumber(450); r4 = Greenfoot.getRandomNumber(450); addObject(w, r3, r4); } }
greenfoot bubble scenerio
By akaur9, with 4 replies.
Last reply by davmac, almost 11 years ago:
yefdel: which version of Greenfoot are you using? (If it is 3.0, please try upgrading to 3.0.1). Please do not hijack discussion threads. Start a new discussion to discuss a new topic.
GreenfootImage doesn't do anything
By polypoly, with 1 reply.
Replied to by Super_Hippo, almost 11 years ago:
Add this line at the end: <Code Omitted>
518
519
520
521
522
523
524
X