Package student.micro.battleship
Class ShipPiece
java.lang.Object
greenfoot.Actor
student.micro.Actor
student.micro.battleship.ShipPiece
public class ShipPiece
extends student.micro.Actor
Represents a ship piece in the game "Battleship", so it can be
shown on the screen.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class student.micro.Actor
addToWorld, getIntersectingObjects, getNeighbors, getNeighbours, getObjectsAtOffset, getObjectsInRange, getOneIntersectingObject, getOneNeighbor, getOneNeighbour, getOneObjectAtOffset, getOneObjectInRange, remove, turnTowards
Methods inherited from class greenfoot.Actor
act, getImage, getRotation, getWorld, getWorldOfType, getX, getY, isAtEdge, move, setImage, setImage, setLocation, setRotation, turn, turnTowards
-
Constructor Details
-
ShipPiece
Create a new Ship piece.- Parameters:
type
- The type of ship in your fleet that this piece represents.x
- The x-coordinate of the position for the ship's bow (its upper-leftmost location on the grid).y
- The y-coordinate of the position for the ship's bow (its upper-leftmost location on the grid).orientedHorizontally
- If true, the ship extends horizontally to the right of the specified position. If false, the ship extends vertically down from the specified position.
-
-
Method Details
-
addedToWorld
public void addedToWorld(greenfoot.World world)
-