Package com.mygdx.game.Logic
Class Board
java.lang.Object
com.mygdx.game.Logic.Board
- All Implemented Interfaces:
java.io.Serializable
public class Board
extends java.lang.Object
implements java.io.Serializable
Board is the class that generates and contains the squares that are active in the game.
It provides methods that make it easy to get the reference of a square in the board
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description Board(int tilesPerSide)
-
Method Summary
Modifier and Type Method Description Square
getSquare(int i, int j)
Square
getSquare(Pawn pawn, int displacement)
int
getTilesPerSide()
static java.lang.Boolean
playerPassedStart(Square start, Square end)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Board
public Board(int tilesPerSide)- Parameters:
tilesPerSide
- The number of squares per side when we count the corners as being in two sides. So 11 for the normal Monopoly board
-
-
Method Details
-
getSquare
- Parameters:
pawn
- The pawn is to be moveddisplacement
- How many squares the pawn should be moved- Returns:
- the square that the pawn should move to
-
getSquare
- Parameters:
i
- Side of the board. Values beetween 0 and 4.j
- Position of square in selected Side. Values beetween 0 and tilesPerSide-2 (0 and 9 normally) (0 counting from the rightmost corner of the side)- Returns:
- The square in that position of the board
- See Also:
- here for a diagram of the board with our coordinate system
-
playerPassedStart
- Parameters:
start
- The square before the moveend
- The square after the move- Returns:
- True if player has passed the start during that move
-
getTilesPerSide
public int getTilesPerSide()- Returns:
- The "fake" number of squares per side. (11 in the default board) The real number is smaller by one (10), so as not to count the corners twice (because the visually belong to two sides)
-