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
How do I use methods from the World?
By Unknown6415, with 3 replies.
Last reply by Unknown6415, over 8 years ago:
Oh yes thanks, I found the exact same way you wrote I time ago in another discussion This works, thanks
Detection Problem
By dirtyninja1, with 4 replies.
Last reply by dirtyninja1, over 8 years ago:
solved it! thanks for the help!
Creating an in-game saving and loading sysytem.
By Kamichalik, with 1 reply.
Replied to by danpost, over 8 years ago:
Kamichalik wrote...
Is it possible to do create a progress saving and loading system for a game in greenfoot (stride)?
I am quite sure that you can still read and write to files locally and have use of the UserInfo storage system in greenfoot, on and off the site.
I NEED IMMEDIATE HELP
By Xmin_Terminator, with 152 replies.
Last reply by danpost, over 8 years ago:
Xmin_Terminator wrote...
What is the reasoning for the code Actor actor = new Actor(); Where Actor is the name of your object Why can't you just have addObject as the only code nessesary
Either way is really okay. However, if you just use addObject and find out later that you need a reference to the object (to call a method on it or to pass it to some other object or in a method call), then you will have to re-write it using the long way. I prefer to use the short way unless absolutely necessary -- but that is just personal preference.
Automatic Gun
By Kamichalik, with 2 replies.
Last reply by Kamichalik, over 8 years ago:
Thanks, I did it. <Code Omitted>
Chracter punches when key pressed once
By het52, with no replies.
im making a fighter game. in this game my character is suppose to punch, move and jump. movement and jump work perfectly fine but my punch method doesnt. when the punch key is pressed once the character is suppose to go through an array to make it look like an animation. but the game isnt going through the animation at all. it sets all the other variables but it doesnt setImage to the punchGif. Code that isnt green is code that i think is affecting the punch method. <Code Omitted>
Collision detect
By alinasomcutean, with 3 replies.
Last reply by Super_Hippo, over 8 years ago:
Two classes will never collide. One object of a class can collide with another object. So either you get a reference to the Die object when a collision was detected in the Personaj class or the Die object needs to get a reference to at least one of the other objects.
Pixel Color Change
By ironphoenix20, with 3 replies.
Last reply by danpost, over 8 years ago:
ironphoenix20 wrote...
My image is an actor so how do I get the x and y of my mouseClick. Would that be the same as the x and y of the pixel?
That would certainly not be the same (unless the top-left corner of the image of the actor was at the top-left corner of the world window). The location of the actor, (x, y), would be the center point of its image. So (x-getImage().getWidth()/2, y-getImage().getHeight()/2) would be the world coorindate of the top-left corner of the actor's image. Subtracting that from the point the mouse was clicked at would produce the (x, y) of the image wher
enemies follow player without moving into wall
By mr.tim_r, with 1 reply.
Replied to by danpost, over 8 years ago:
There are various ways to do that. Using a "line-of-sight" object is one of the most common ways. Also, it may help to keep the last location of chased player in an enemy that had one in its sights (so the enemy could proceed toward that location (when the player moves behind a wall) to see if sight on the player can be re-acquired (if no other player is currently in sight).
Here
is a link to an earlier discussion on a LineOfSight object.
HELP ASAP java.lang.IllegalStateException: Actor not in world.
By ttrussell, with 2 replies.
Last reply by ttrussell, over 8 years ago:
I actually just found a fix myself i changed the checkFlyingsaucerHit and checkAsteroidHit to a single method public void act() { if(life <= 0) { getWorld().removeObject(this); return; } else { life--; move(); checkAHit(); } } private void checkAHit() { FlyingSaucer flyingsaucer = (FlyingSaucer) getOneIntersectingObject(FlyingSaucer.class); if (flyingsaucer != null){ getWorld().removeObject(this); flyingsau
Why can't I save the world?
By Alola_Sandslash, with 1 reply.
Replied to by danpost, over 8 years ago:
Alola_Sandslash wrote...
Why can't I save the world when I am inside of a world that is not the first one to load. Is there anyway to be able to do it?
You can temporarily make it the first one by manually creating a world of that type. When done, manually create the world that is to be first to make it first.
Why doesn't this code work?
By Wasupmacuz, with 15 replies.
Last reply by Wasupmacuz, over 8 years ago:
Yehuda wrote...
The coordinates for the drawString method are that the X puts the left side of the first letter at the specified X, but the Y puts the bottom of the text as the specified Y so since your text is 11 pixels high you have to set the Y for drawString as at least 11.
Thank you Yehuda :)
Create Title Page
By suge5, with 3 replies.
Last reply by danpost, over 8 years ago:
The started method along with the 'world' field should go in your title screen world (the picture saying "press anywhere to start"). Manually create the world after you move them into it. See my last post as to what to put in the Instructions world class.
Please Help Me!
By suge5, with 2 replies.
Last reply by suge5, over 8 years ago:
Still Having a little trouble...
public class FrogHunter extends Actor { public void act(){ if(Greenfoot.mouseMoved(null)) { //whenever the mouse is moved MouseInfo mouse = Greenfoot.getMouseInfo(); // obtains information from the mouse setLocation(mouse.getX(), mouse.getY()); // sets the locaion of the bat to where the user places the mouse in the world } if(Greenfoot.mouseClicked(null)) { //finds all ibjects int x = -getImage().getWidth()/2; //sets location of bat you can hit animal with i
Greenfoot chapter 4
By Ethan, with 2 replies.
Last reply by Ethan, over 8 years ago:
Thanks!
351
352
353
354
355
356
357
X