This module contains functions for creating tiles. These tiles are used for the tiledArea function from the main module.
The basic tile constructor. The two arguments is the position of the sprite in the tileset.
As an example
tile (4,2)is the 4 row in the second column of the tileset.
Makes a Tile transition between positions. This is useful for sprites that will change their position during the game.
Note: The string should be unique, if not the transition might fail every now and then.
Note: The string will be a id Attribute in a html node, so be careful not to use names that might be already taken.
Adds animations to a tile. The sprites of the animation must be arranged horizontally in the tileset.
The following code specifies a tile with 3+1 frames
tile (0,0) |> animated 3Note: Setting the steps to 0 describes a tile with no animation.
tile (0,0) |> animated 0 == tile (0,0)Note: Negaive steps are not supported, in this case no animation will be played.
Adds custom attributes. use the elm-css Attributes.
The motivation for this function was so that one can create onClick events.
A Tileset contains the actuall image that a tile can reference.
The tileset constructor has the following parameters:
For example the following defines the tileset that is used in the example.
{width: 16, height 16,source: "https://orasund.github.io/pixelengine/tileset.png"}
A tile defines a sprite in a tileset. The following functions are intended to be modular.
A example for a tile could be: