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 would you find what direction a sprite is ??
By -nic-, with 3 replies.
Last reply by SPower, about 12 years ago:
You're welcome
how to get a picture without a white bagschreen
By martijn13039, with 5 replies.
Last reply by -nic-, about 12 years ago:
press ctrl+n for a new img and go to advanced options go to fill with and select trancparancy then paste img and then use eraser tool to delete bits you want to be inviable i hop i helped please ask if you have more questions [Disallowed URL]
Object moving from one spot to another continually
By Alfie5, with 2 replies.
Last reply by danpost, about 12 years ago:
Another way is by saving just the other location (the one it is not at). I will call your object a 'Teleporter': Use <Code Omitted>to add the object to the world (nextX, nextY, currentX, and currentY need to be set to the coordinates of the two points the object teleports between). The 'Teleporter' class needs a constructor to receive the two coordinates sent to it; so, this code would go in the 'Teleporter' class:
removing objects at the left of screen
By e_e13, with 57 replies.
Last reply by danpost, about 12 years ago:
When 'getWorld' is called, it tries to return the world that the object in question (the counter) is in. If is has not been 'addObject'ed to the world or it has been 'removeObject'ed from the world, then 'getWorld' will return 'null' and a NullPointerException occurs.
Multiple worlds?
By ttamasu, with 4 replies.
Last reply by davmac, about 12 years ago:
Its Greenfoot.SetWorld(World). It associates another world the with same actors.
This might just be a matter of terminology, but, no, Greenfoot.setWorld(...) doesn't associate another world with the same actors - it just makes another world active. The other world might have a completely different set of actors in it (or none at all).
I was hoping there was a way to keep two independent sets of worlds so I can do some background processing while the current one is being played.
You can do this by manually calling the act() method of each actor in the othe
how would you create levels
By -nic-, with 6 replies.
Last reply by -nic-, about 12 years ago:
ok i got it working
Char to integer
By nooby123, with 5 replies.
Last reply by nooby123, about 12 years ago:
Thanks very much!
My world disappeared right after I compiled!
By MakerOfGames, with 10 replies.
Last reply by davmac, about 12 years ago:
tylers, exact same problem = exact same solution :p ... but please start a new discussion to post your code to avoid getting things mixed up in this one.
adding a copy of itself
By Razzo, with no replies.
I've been using an ArrayList for an Inventory, And bound to each item is a variable; amt, (Amount) When I drop something, I want it to, if amt > 1; addClone if amt == 1; addItself.. Ive been doing this but I dont know how to add its own class.. This is what I have been doing <Code Omitted>
turn towards
By tylers, with 5 replies.
Last reply by tylers, about 12 years ago:
yes forgot to put that.
when are you online?
By tylers, with 2 replies.
Last reply by tylers, about 12 years ago:
no I meant this as like a survey type thing. what time are you online on greenfoot. thank for replying i need this for something im doing on a scenario.
I need help on some code.
By MakerOfGames, with 1 reply.
Replied to by SPower, about 12 years ago:
If(getX() == aNumber && getY() == anotherNumber) { turn } That wasn't so hard, was it?
Adventure Game Collision
By RedPhoneBooth, with no replies.
Hey, I have just spent like 30 minutes working on a simple adventure game, its looking pretty good but now ive been stuck for a while with collision detection. I decided to make the cells 1 pixel so I have the freedom to make good looking and complicated scenery but the problem is I want the player to be able to go under bridges or partially under trees and stuff like that. So far everything ive tried just ballzed stuff up, so like I was wanting like a specific solid area for each object that I could "draw" into the world. Btw, im using the getX, getY, and setLocation methods for movement. Thx for the help! PS: Also, ive decided to scrap the idea of scrolling and go old school, u know, like the games where each screen was a new "area" that was mainly static and had the player walk from tile to tile, but how would I do somthing like that? I could have like shittons of World Classes and like switch between each one, but I could also just switch the background image between a two dimensional array in one world class, I might do that, but if you have any ideas... PPS: Sorry for the triple whammy of questions but I wouldn't mind creating multilayer as well, although I have no clue how to do so, how do you code servers and stuff like that? just give me the basic knowledge so I can decide weather its worth my time and effort to do cause that would be really fun but I imagine really hard to do. oh well, ill focus on single player for now.
TRacking ojects
By -nic-, with 4 replies.
Last reply by tkiesel, about 12 years ago:
My //comment above should have read close TO 90% of distance to target. Oops. ;)
How to get the hight and width of the computer screen?
By K_O_P, with 5 replies.
Last reply by ttamasu, about 12 years ago:
What tkiesel said works... All you need is the toolkit. Here is simple mock up, for instance: ---------------------- import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.awt.Dimension; import java.awt.Toolkit; /** * Write a description of class goo here. * * @author Takashi * @version 1 */ public class goo extends World{ public goo(){ super((int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(), (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight(),1); //Debug
982
983
984
985
986
987
988
X