Skip to contents

Clears the console and starts a game of 'r.oguelike' by printing a map with an inventory and status message. The user inputs a keypress to move the character and explore the map, fighting enemies and collecting objects.

Usage

start_game(
  max_turns = Inf,
  iterations = 5,
  n_row = 30,
  n_col = 40,
  n_rooms = 5,
  is_snake = FALSE,
  is_organic = TRUE,
  is_colour = TRUE
)

Arguments

max_turns

Numeric. How many turns? Default is Inf(inite).

iterations

Numeric. How many times to 'grow' iteratively the dungeon rooms, where tiles adjacent to current floor tiles (.) have a random chance of becoming floor tiles themselves with each iteration.

n_row

Numeric. Number of row tiles in the dungeon, i.e. its height.

n_col

Numeric. Number of column tiles in the dungeon, i.e. its width.

n_rooms

Numeric. Number of rooms to place randomly on the map as starting points for iterative growth.

is_snake

Logical. Should the room start points be connected randomly (FALSE, the default) or from left to right across the room matrix (TRUE)? See details.

is_organic

Logical. Join the room start points with corridors before iterative growth steps (TRUE, the default), or after (FALSE)? See details.

is_colour

Logical. Should the characters in the output be coloured using crayon (TRUE, the default)?

Value

Nothing. Clears the console and prints to it with cat.

Details

Use the WASD keys to move up, left, down and right. Use the '1' key to eat an apple from your inventory. Use the '0' to quit the game. If your terminal supports the 'keypress' package, then you can use a single keypress as input (e.g. the up arrow key), otherwise you will have to type at the prompt and then press 'Enter'.Use has_keypress_support to see if 'keypress' is supported.

Symbols used in the game are as follows:

  • . floor tile

  • # wall

  • @ player (10 HP max, -1 HP attack damage)

  • $ gold (+1 to +3 G)

  • E enemy (3 HP max, -1 HP attack damage)

  • a apple (+1 HP)

Examples

if (FALSE) start_game()