java.lang.Objectgreenfoot.Actor
MasterAlien
public abstract class MasterAlien
This class implements some of the more complicated functionality of the alien block, and provides helper methods to use in the Alien subclass. It is provided complete and does not need to be modified.
Field Summary | |
---|---|
protected int |
HSTEP
The step moved by the aliens horizontally. |
protected int |
YSTEP
The step moved by the aliens vertically. |
Constructor Summary | |
---|---|
MasterAlien()
|
Method Summary | |
---|---|
void |
addedToWorld(greenfoot.World world)
Called when the object is added into the world, you can safely ignore this method. |
protected boolean |
allGone()
Return whether there are any more aliens. |
protected boolean |
atBottom()
Return whether the alien block is at the bottom of the screen |
protected boolean |
atEdge()
Return whether the alien block is at the horiztonal edges of the screen. |
protected void |
gameOver()
Called when the game has ended. |
protected boolean |
getDirection()
Return whether the aliens are moving right or left. |
protected void |
move(int x,
int y)
Move all the aliens by x steps horizontally and y steps vertically. |
protected void |
reverseDirection()
Reverse the direction of travel. |
Methods inherited from class greenfoot.Actor |
---|
act, getHeight, getImage, getIntersectingObjects, getNeighbours, getObjectsAtOffset, getObjectsInRange, getOneIntersectingObject, getOneObjectAtOffset, getRotation, getWidth, getWorld, getX, getY, intersects, setImage, setImage, setLocation, setRotation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final int HSTEP
protected final int YSTEP
Constructor Detail |
---|
public MasterAlien()
Method Detail |
---|
public void addedToWorld(greenfoot.World world)
addedToWorld
in class greenfoot.Actor
world
- The world the object was added to.protected boolean allGone()
protected boolean atBottom()
protected boolean atEdge()
protected void gameOver()
protected boolean getDirection()
protected void move(int x, int y)
x
- the number of steps to move horizontallyy
- the number of steps to move verticallyprotected void reverseDirection()