Title: | Puzzle Game for the R Console |
---|---|
Description: | Puzzle game that can be played in the R console. Restore the pixel art by shifting rows. |
Authors: | Roland Krasser [aut, cre] |
Maintainer: | Roland Krasser <[email protected]> |
License: | GPL-3 |
Version: | 1.0.1 |
Built: | 2025-02-17 03:44:22 UTC |
Source: | https://github.com/rolkra/pixelpuzzle |
Colorize a sprite
colorize_sprite(img, colors = c("X", "S", "W", "S", "X", "ORI"), sleep = 0.1)
colorize_sprite(img, colors = c("X", "S", "W", "S", "X", "ORI"), sleep = 0.1)
img |
Sprite |
colors |
Vector of colors that are used |
sleep |
Time between setting colors |
Nothing
Combine two sprite
combine_sprite(img, img2, gap = 1)
combine_sprite(img, img2, gap = 1)
img |
Sprite 1 |
img2 |
Sprite 2 (added on the right) |
gap |
Gap between the sprites |
Sprite
sprites <- define_sprite() sprite1 <- sprites[["buhu"]] sprite2 <- sprites[["sword"]] show_sprite(combine_sprite(sprite1, sprite2))
sprites <- define_sprite() sprite1 <- sprites[["buhu"]] sprite2 <- sprites[["sword"]] show_sprite(combine_sprite(sprite1, sprite2))
Returns a list of predefined sprites
define_sprite()
define_sprite()
List of sprites
sprites <- define_sprite() ## show first sprite show_sprite(sprites[[1]]) ## show sprite named "sword" show_sprite(sprites[["sword"]])
sprites <- define_sprite() ## show first sprite show_sprite(sprites[[1]]) ## show sprite named "sword" show_sprite(sprites[["sword"]])
Flip a sprite
flip_sprite(img)
flip_sprite(img)
img |
Sprite |
Sprite
sprites <- define_sprite() sprite <- sprites[["sword"]] show_sprite(flip_sprite(sprite))
sprites <- define_sprite() sprite <- sprites[["sword"]] show_sprite(flip_sprite(sprite))
Intro of pixelpuzzle game
intro(sleep = 0.1)
intro(sleep = 0.1)
sleep |
How long to wait between change of color |
Nothing
Play pixelpuzzle in the R-console
pixelpuzzle(img = NA, bg = ".")
pixelpuzzle(img = NA, bg = ".")
img |
Image of Sprite (vector of strings). If no sprite is provided, the player can choose one of the predefined pixel arts. |
bg |
Background color, default is transparent (".") |
Nothing
## Start game (in interactive R sessions) if (interactive()) { pixelpuzzle() }
## Start game (in interactive R sessions) if (interactive()) { pixelpuzzle() }
Play pixelpuzzle with a sprite
play_sprite(img, ori, bg = ".")
play_sprite(img, ori, bg = ".")
img |
Sprite to play with |
ori |
Original Sprite |
bg |
Background ("." is transparent) |
Nothing
Select one of the predefined sprites
select_sprite(sprites, bg = ".")
select_sprite(sprites, bg = ".")
sprites |
List of predefined sprites |
bg |
Background of the sprite ("." = transparent) |
Sprite
Sift a row of the sprite
shift_sprite_row(img, row = 1, shift = 1)
shift_sprite_row(img, row = 1, shift = 1)
img |
Image of Sprite (vector of strings) |
row |
Which row is shifted |
shift |
Nuber of shifts |
Sprite
Show a sprite in console
show_sprite(img, rownumbers = TRUE, cls = TRUE, bg = ".")
show_sprite(img, rownumbers = TRUE, cls = TRUE, bg = ".")
img |
Image of Sprite (vector of strings) |
rownumbers |
Show rownumbers on the left side? |
cls |
Clear Screen before drawing sprite? |
bg |
Background color, default is transparent (".") |
Prints sprite in console
sprites <- define_sprite() ## show first sprite show_sprite(sprites[[1]]) ## show sprite named "sword" show_sprite(sprites[["sword"]])
sprites <- define_sprite() ## show first sprite show_sprite(sprites[[1]]) ## show sprite named "sword" show_sprite(sprites[["sword"]])
Shuffle a sprite randomly
shuffle_sprite(img, difficulty = 1)
shuffle_sprite(img, difficulty = 1)
img |
Sprite |
difficulty |
Difficulty (intensity of shuffeling) |
List of sprites
sprites <- define_sprite() sprite <- sprites[["sword"]] show_sprite(shuffle_sprite(sprite))
sprites <- define_sprite() sprite <- sprites[["sword"]] show_sprite(shuffle_sprite(sprite))