Skip to contents

meeple_bits() returns meeples.

Usage

meeple_bits(
  ...,
  side = "face",
  piece_side = paste0("bit_", side),
  suit = 1:6,
  x = as.double(1:6),
  y = 1,
  angle = 0,
  length.out = NA_integer_
)

Arguments

...

Should be left empty.

side

Either "face" or "back".

piece_side

Either "tile_face" or "tile_back".

suit

Suit value (color) of meeples. 1L is "red", 2L is "black", 3L is "green", 4L is "blue", 5L is "yellow", and 6L is "white". Will be coerced by piece_suit().

x, y

Cartesian coordinates (numeric vectors)

angle

Rotation of piece (numeric vector of degrees, counter-clockwise). Will be coerced by piece_angle().

length.out

The number of pieces. Not needed if all the arguments are the same length (or of length one) and this length is the same as the number of desired pieces.

Value

A tibble::tibble() data frame with the following columns:

  • "piece_side"

  • "suit"

  • "rank"

  • "cfg" (optional, defaults to "piecepack")

  • "x"

  • "y"

  • "angle" (optional, defaults to 0).

This data frame is compatible with piecepackr::render_piece() and likely ppcli::cat_piece().

Examples

a <- c(0, 90, 180, 270, 0, 90)
df1 <- meeple_bits(side = "face", suit = 1:6, x = 1:6, y = 1, angle = a)
df2 <- meeple_bits(side = "top", suit = 1:6, x = 1:6, y = 2, angle = a)
df <- rbind(df1, df2)
if (require("piecepackr", quietly = TRUE) &&
    packageVersion("piecepackr") >= "1.15.0-1") {
  grid::grid.newpage()
  envir = game_systems()
  pmap_piece(df, envir = envir, default.units = "in", op_scale = 0.5)
}