Description Details Value Public fields Methods Examples
Generate An R6-Class 'Action Squirrel' Game
Generate An R6-Class 'Action Squirrel' Game
Prints to the console a grid of emoji representing an overworld, including a player character that can be controlled by the user. Also provides a live tally of moves taken.
Console output with cat()
.
active
Logcial. Is the game in play?
overworld
Character vector. The overworld in one dimension.
s_loc
Numeric. The location of the squirrel.
n_loc
Numeric. The location of the nut.
o_loc
Numeric. The location of the owl.
moves
Numeric. The number of moves made by the player.
nuts
Numeric. The number of nuts collected by the player.
new()
Create a new overworld.
ActionSquirrel$new()
An R6-class object.
pause()
Pause menu with instructions.
ActionSquirrel$pause()
An R6-class object.
move()
Move the hero around the overworld.
ActionSquirrel$move(where = c("up", "down", "left", "right"))
where
Character. Which direction to move. One of "up"
,
"down"
, "left"
and "right"
.
An R6-class object.
clone()
The objects of this class are cloneable with this method.
ActionSquirrel$clone(deep = FALSE)
deep
Whether to make a deep clone.
1 2 3 4 5 6 | ## Not run:
x <- ActionSquirrel$new() # generate overworld
x$move("up") # move character up
x$move("right") # move character right
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.