robinheghan/elm-warrior/1.0.0

NOTE: the latest version is 1.0.1

Formerly Skinney/elm-warrior. Search finds this package by either name.

Warrior.Map.Builder

You can use this module to build your own maps!

A map in progress.

Map layout

type alias Size =
{ rows : Int
, columns : Int
}

Describes how large a map should be in rows and columns.

init : Size -> Template

Initialize an empty map of a given size where every tile is empty. Use the the following with functions to make the map more interesting.

Sets a description for the map which will be displayed above the map when the game is played.

withSpawnPoint : Coordinate -> Template -> Template

Marks a coordinate on the map where a playable warrior will spawn.

withExitPoint : Coordinate -> Template -> Template

Marks a coordinate on the map where the player needs to go to advance to the next map.

withWalledArea : Coordinate -> Coordinate -> Template -> Template

Turns every tile between two coordinates into wall tiles.

Non-playable characters (Npc's) and Items

String
-> Coordinate
-> (Warrior -> Map -> History -> Action)

Places a villain on the specific coordinate of the map, using the supplied function to know what to do each turn. You can find pre-made turn functions in the Warrior.Npc module.

Places an item into the inventory of the last villain added with the withNpc function.

withItem : Coordinate -> Item -> Template -> Template

Places an item on the map which can be picked up by warriors.

Queries

spawnPoints : Template -> List Coordinate

A list of points where warriors can spawn.

npcs : Template -> List ( Warrior, Warrior -> Map -> History -> Action )

Return a list of all non-playable characters along with their turn functions.

Finally

build : Template -> Map

Turn this template into a map