start_game | R Documentation |
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. This is a toy; a proof-of-concept.
start_game( max_turns = Inf, n_row = 20L, n_col = 30L, n_rooms = 5L, iterations = 4L, is_snake = FALSE, is_organic = TRUE, has_colour = TRUE, has_sfx = TRUE )
max_turns |
Integer. How many turns? Default is |
n_row |
Integer Number of row tiles in the dungeon, i.e. its height. |
n_col |
Integer. Number of column tiles in the dungeon, i.e. its width. |
n_rooms |
Integer Number of rooms to place randomly on the map as starting points for iterative growth. |
iterations |
Integer. How many times to 'grow' iteratively the dungeon
rooms, where tiles adjacent to current floor tiles ( |
is_snake |
Logical. Should the room start points be connected randomly
( |
is_organic |
Logical. Join the room start points with corridors before
iterative growth steps ( |
has_colour |
Logical. Should the characters in the output be coloured
using |
has_sfx |
Logical. Should sound effects be used? Defaults to
|
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)
When TRUE
, is_snake
will tend to create one continuous cavern;
is_organic
will tend to create more 'natural' looking caves.
Arguments that take integer values are coerced to integer if provided as numeric values.
Nothing. Clears the console and prints to it with
cat
.
## Not run: start_game()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.