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
Calling an object's methods
By dark_sky, with 4 replies.
Last reply by IsVarious, over 13 years ago:
A tip for code placement: It's normaly a good idea to put code in the place it makes the most sense, so for your example above. Are you wanting to player look for the box, or the box look for the player? it may seem like a subtle difference, but as a project expands, it does help to place code in natrualy logical locations.
Variable from another world?
By MrDoomsday, with 2 replies.
Last reply by IsVarious, over 13 years ago:
So for example if your variable was "pizzaLeft", you would declair it as 'public static int pizzaLeft;" this would enable you to access it from another level.
Creating a New World
By theDoctor, with 5 replies.
Last reply by IsVarious, over 13 years ago:
lol, in the constructor of the new level, set the location of where you want your actor to be added, think of this like you're working with your first level, but you can have many different. you can also setup conditions if they are met after leaving that building, where you want your actor to be placed. here's the same code we used for our final project which did this exact same thing.
Help with movement code
By DAustin15, with 11 replies.
Last reply by danpost, over 13 years ago:
Well, after having a look at the board, I can tell, that this will not be as easy as I had believed at first. Also, with 4 pieces on the board at the same time, you certainly do not what them landing exactly on the same spot when on the same square. That adds another level of complexity. However, with the proper helper objects, and object image manipulation, I believe we can make it work. I am thinking about an array of Pad objects (invisible 'landing' pads for the pieces; 40 of them; one for each spot on the board that a piece can land on). They each can have a reference to the spot in
I can compile it, there are no errors for the code but then something happen
By martijn13039, with 2 replies.
Last reply by martijn13039, over 13 years ago:
Plz Could somebody help me because I have really no idea, and it is really anoying because the game work fine but the wole time if i am playing wil come thise window but i could still playing the game some advice plz?
bouncing of walls
By tylers, with 4 replies.
Last reply by tylers, over 13 years ago:
how do i stop it from bouncing from one wall to another in the same place
fixed it
Referencing Strings from another class.
By JayWood860, with 1 reply.
Replied to by JayWood860, over 13 years ago:
As for the textbox, the method is irrelevant at this point i did not mean to add it. just the parameter to show that i was adding it to the world correctly. and if this was not previously stated, there are no syntax errors through the program, just this issue i have right now.
Levels
By Matt, with 6 replies.
Last reply by trash1000, over 13 years ago:
Apart from different worlds you could always go and use files to read out the structure of a level. However, it's highly dependent on how your levels are structured.
Removing Actors
By Matt, with 2 replies.
Last reply by Matt, over 13 years ago:
I dont really understand the things written on that page :(
How to exit only when door is open.
By dlanni, with 12 replies.
Last reply by dlanni, over 13 years ago:
Thanks so much. I'll get to work on this .
Need a little help with java.awt.Graphics
By darkmist255, with 25 replies.
Last reply by danpost, over 13 years ago:
@pyrokey3, in your code, lines 6 through 9 can be replaced with this one line <Code Omitted>
getObjectsInRange help?
By PiercingGoblin, with 1 reply.
Replied to by Builderboy2005, over 13 years ago:
The command getObjectsInRange() returns a List object that is never null, but might have a size of zero. Therefore, instead of checking to see if the list is null, you should check to see if it has a size of zero, using the .size() method :)
Anybody know the code to theses certain circumstances?
By DAustin15, with 1 reply.
Replied to by danpost, over 13 years ago:
Check out one of my Snake Demo scenarios. It has code for 4-way movement (up, down, left, and right). The only difference being that the Snake is user-controlled (by the arrow keys), and your scenario will just increment the direction value (direction = (direction + 1) % 4; when it reaches the edges). Get all individual parts of the game working first, then work on combining them into a complete game.
scale
By tylers, with 1 reply.
Replied to by danpost, over 13 years ago:
Each time the act method is called, you end up scaling a scaled image. The result in doing this is what you see happening. What you need to do, is create a
new
GreenfootImage by using one of its constructors (probably the one that uses the filename, since you made it in gimp), and scale that new image directly to the required size.
World Movement
By thefutureisnow, with 6 replies.
Last reply by Builderboy2005, over 13 years ago:
As long as you make your Greenfoot world an open world (it's an option in the constructor) objects will be able to move anywhere (including off the screen) without a problem.
970
971
972
973
974
975
976
X