|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgreenfoot.sofiainternal.World
sofia.micro.World
sofia.micro.greenfoot.World
public class World
A small "adaptor" class that provides Greenfoot-style methods for some World features. It is intended to provide for source-level compatibility of some Greenfoot examples.
Constructor Summary | |
---|---|
World()
Construct a new world with a default size of 20 x 12. |
|
World(int width,
int height)
Construct a new world. |
|
World(int width,
int height,
int scaledCellSize)
Construct a new world. |
Method Summary | |
---|---|
void |
addObject(Actor actor,
int x,
int y)
Add an Actor to the world at a specified location. |
void |
removeObject(Actor actor)
Remove an Actor from the world. |
void |
setBackground(Image background)
Set a background image to use for each Cell. |
void |
setBackground(java.lang.String background)
Set a background image to use for each Cell. |
Methods inherited from class sofia.micro.World |
---|
act, add, add, backgroundIsForCells, getBackground, getHeight, getObjects, getObjects, getObjectsAt, getOrientation, getSpeed, getWidth, numberOfObjects, remove, setActOrder, setBackgroundColor, setCellBackground, setCellBackground, setGridColor, setOrientation, setPaintOrder, setScaledCellSize, setSpeed, setWorldBackground, setWorldBackground, start, started, stop, stopped |
Methods inherited from class greenfoot.sofiainternal.World |
---|
_gf_addObject, _gf_getBackground, _gf_getCellSize, _gf_getColorAt, _gf_getIntersectingObjects, _gf_getNeighbours, _gf_getObjects, _gf_getObjectsAt, _gf_getObjectsInDirection, _gf_getObjectsInRange, _gf_getOneIntersectingObject, _gf_getOneObjectAt, _gf_removeObject, _gf_removeObjects, _gf_repaint, _gf_setActOrder, _gf_setBackground, _gf_setBackground, _gf_setPaintOrder |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public World()
If an image based on the world's class name exists, it will be used as the background for each cell.
public World(int width, int height)
If an image based on the world's class name exists, it will be used as the background for each cell.
width
- The width of the world (in cells).height
- The height of the world (in cells).public World(int width, int height, int scaledCellSize)
If an image based on the world's class name exists, it will be used as the background for each cell.
width
- The width of the world (in cells).height
- The height of the world (in cells).scaledCellSize
- For rendering bitmaps, treat each cell as if
it were a square of this many pixels on each side.Method Detail |
---|
public void addObject(Actor actor, int x, int y)
This method is identical to add()
, but is provided for
Greenfoot compatibility.
actor
- The Actor to add.x
- The x coordinate of the location where the actor is added.y
- The y coordinate of the location where the actor is added.public void removeObject(Actor actor)
This method is identical to remove()
, but is provided
for Greenfoot compatibility.
actor
- The Actor to remove.public void setBackground(Image background)
background
- The background image to use for each cell.public void setBackground(java.lang.String background)
background
- The background image to use for each cell.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |