asciigame: library for making ascii-colored games

asciigame contains a syntax to make colored asciiart, which can be loaded to the Ele editor.

If you want to start writing ASCII art with Ele (or vim) here are some helpful references to get you started:

acs: write ascii sprites

.acs files contain a series of named "sprites" which are lines of text, followed by their asciicolor foreground style and asciicolor background style.

-- The below is typically put at the top of all acs sheets as a color
-- reference and is ignored by the parser.

-- Color Pallet:
< Z B D L W R P Y H G T C A N S M F I
--e l a i h e i e o r e y q a k a u n
--r a r g i d n l n e a a u v y g s v
--o c k h t   k l e e   n a y   e c i
--  k   g e     o y n           n h s
--      t       w               t i i
--                              a a b
--                                  l
--                                  e

-- An example 3x3 sprite named "man"
# 3x3 man
'  O
' /|\
' / \
-- The foreground colors: yellow skin, blue clothes.
>  y
> yny
> n n
-- No background is specified for "man", which means
-- he adopts the backround he is on.


-- An example 3x3 sprite named "woman" wearing a dress.
# 3x3 woman
'  O=
' /|\
' /~\
-- The foreground colors: pink skin, patterned red clothes, brown hair
>  pb
> plp
> rlr
-- The background colors: fills in the inside of the dress.
<
<  r
<  r

Renders as this image

The sprite text "consumes" the next foreground/background line below it, allowing for user-control of how they lay out the colors. For instance, you could draw the man like this, with the foreground colors directly below to the text.

# 3x3 man
'  O
>  y

' /|\
> yny

' / \
> n n

Each line starts with one of ' < > indicating text, background or foreground. The character following it sets the "default style" for that line, which replaces any spaces or missing characters.

Mod asciigame

Library of game-related types and utilities.

Types: Sprite Rand

Record Sprite

A sprite with a location. Used by games to more easily write to the Game grid by simply appending the txt/fg/bg.

Fields:

Record Rand

Random number generator using the Linear Congruential Generator forumla. This should not be used for security-critical applications.

Example:

local ix = require'civix'
local r = Rand{state = ix.epoch():asMs()
r(1, 100) -- get a number from [1-100]

Fields:

Methods

Mod asciigame.acs

acs: library for asciicolor sprites loading and coloring.

Types: AcsLine AcsSprite

Functions

Record AcsLine

A parsed line of AcsSprite with the information about where it is from.

Fields:

Record AcsSprite

A fully parsed sprite, which is a list of lines.

Fields:

Methods