|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgreenfoot.sofiainternal.Actor
sofia.graphics.Shape
sofia.graphics.ImageShape
sofia.micro.Actor
sofia.micro.greenfoot.Actor
public class Actor
A small "adaptor" class that provides Greenfoot-style methods for some Actor features. It is intended to provide for source-level compatibility of some Greenfoot examples.
Constructor Summary | |
---|---|
Actor()
Create a new Actor. |
|
Actor(boolean scaleToCell)
Create a new Actor. |
|
Actor(java.lang.String nickName)
Create a new Actor. |
|
Actor(java.lang.String nickName,
boolean scaleToCell)
Create a new Actor. |
Method Summary | ||
---|---|---|
GreenfootImage |
getGreenfootImage()
Returns the image used to represent this actor, as a GreenfootImage object. |
|
protected
|
getNeighbours(float distance,
boolean diagonal,
java.lang.Class<MyActor> cls)
Return the neighbors to this object within a given distance. |
|
World |
getWorld()
Return the world that this actor lives in. |
|
void |
setLocation(int x,
int y)
Assign a new location for this actor. |
Methods inherited from class sofia.micro.Actor |
---|
act, addedToWorld, addOther, getGridX, getGridY, getImage, getIntersectingObjects, getNeighbors, getNickName, getObjectsAtOffset, getObjectsInRange, getOneIntersectingObject, getOneObjectAtOffset, getShape, move, remove, setBounds, setGridLocation, setGridX, setGridY, setImage, setImage, setNickName, setPosition, setPosition, setPositionAnchor, setPositionAnchor, setRotation, setX, setY, toString, turn, turnTowards, turnTowards |
Methods inherited from class sofia.graphics.ImageShape |
---|
getSourceBounds, setBitmap, setSourceBounds, setSourceBounds |
Methods inherited from class sofia.graphics.Shape |
---|
conditionallyRelayout, conditionallyRepaint, contains, contains, extendsOutside, getAlpha, getBounds, getColor, getHeight, getPosition, getPositionAnchor, getRotation, getRotationPivot, getShapeParent, getWidth, getX, getY, getZIndex, intersects, isInFrontOf, isVisible, move, notifyParentOfPositionChange, onBoundsResolved, rotateBy, setAlpha, setColor, setRotation, setRotation, setVisible, setZIndex |
Methods inherited from class greenfoot.sofiainternal.Actor |
---|
_gf_addToWorld, _gf_getBoundingXs, _gf_getBoundingYs, _gf_getDelegate, _gf_getImage, _gf_getIntersectingObjects, _gf_getNeighbours, _gf_getObjectsAtOffset, _gf_getObjectsInRange, _gf_getOneIntersectingObject, _gf_getOneObjectAtOffset, _gf_getRotation, _gf_getX, _gf_getY, _gf_setImage, _gf_setImage, _gf_setLocation, _gf_setRotation, _gf_turn, addedToWorld, containsPoint, intersects |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Actor()
public Actor(java.lang.String nickName)
nickName
- The nickname for this actor.public Actor(boolean scaleToCell)
scaleToCell
- If true, the Actor's image will be scaled to
the dimensions of a single World grid cell, while
preserving aspect ratio. If false, the image
will be sized relative to the underlying bitmap
or shape.public Actor(java.lang.String nickName, boolean scaleToCell)
nickName
- The nickname for this actor.scaleToCell
- If true, the Actor's image will be scaled to
the dimensions of a single World grid cell, while
preserving aspect ratio. If false, the image
will be sized relative to the underlying bitmap
or shape.Method Detail |
---|
public World getWorld()
Actor
getWorld
in class Actor
public void setLocation(int x, int y)
x
- Location index on the x-axis.y
- Location index on the y-axis.Actor.move(int)
protected <MyActor extends Actor> java.util.Set<MyActor> getNeighbours(float distance, boolean diagonal, java.lang.Class<MyActor> cls)
All cells that can be reached in the number of steps given in 'distance' from this object are considered. Steps may be only in the four main directions, or may include diagonal steps, depending on the 'diagonal' parameter. Thus, a distance/diagonal specification of (1,false) will inspect four cells, (1,true) will inspect eight cells.
MyActor
- The type of actor to look for, as specified
in the cls parameter.distance
- Distance (in cells) in which to look for other objects.diagonal
- If true, include diagonal steps.cls
- Class of objects to look for (passing 'null' will find all
objects).
public GreenfootImage getGreenfootImage()
GreenfootImage
object. This image can be modified to
change the actor's appearance.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |