knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

rpg

Play a role playing game in the R console.

Installation

# Install development version from GitHub
devtools::install_github("anthonypileggi/rpg")

Example

library(rpg)

# Create a new player
x <- Player$new("Hero")
x

# Fight some monsters
x$fight("slime")

x$fight("skeleton")

# Check your current status
x

# Rest to heal yourself; if your HP falls to 0 then it's GAME OVER!
x$rest()
x

# Watch out, it's a giant!
x$fight("giant")

# Whew, we did it.  Now we just need to deal with one last slime...
x$fight("slime")

Journal

Access your journal to relive the adventure!

cat(tail(x$journal))

Bestiary

Check out the full list of monsters you can fight!

bestiary()

Shiny

I am also working on a shiny version. It is still WIP, but it already looks really neat thanks to the nessy package!



anthonypileggi/rpg documentation built on May 21, 2019, 10:10 a.m.