A graphic engine for turn-based pixel games.
To get started, copy the following project
import Css exposing (px)
import Html.Styled exposing (toUnstyled)
import PixelEngine.Graphics as Graphics exposing (Background(..), Tileset)
main =
let
tileSize : Int
tileSize =
16
windowSize : Int
windowSize =
16
scale : Int
scale =
2
width : Css.Px
width =
px <| toFloat <| (windowSize * tileSize * scale)
tileset : Tileset
tileset =
{ source = "tileset.png", width = 16, height = 16 }
goblin =
Graphics.animatedTile ( 2, 8 ) 1
letter_h =
Graphics.tile ( 1, 15 )
letter_i =
Graphics.tile ( 2, 12 )
heart =
Graphics.tile ( 4, 8 )
in
Graphics.render
{ scale = scale, width = width }
[ Graphics.tiledArea
{ height = windowSize, tileset = tileset, background = Color (Css.rgb 20 12 28) }
[ ( ( 6, 7 ), goblin )
, ( ( 7, 7 ), letter_h )
, ( ( 8, 7 ), letter_i )
, ( ( 9, 7 ), heart )
]
]
|> toUnstyledPossible backgrounds for an area.
Color (Css.rgb 20 12 28)Image "groundTile.png"Configurations of the engine.
{scale = 1,width = px 800}Renders the content. Use the elm-css Html in combination with this function.
A single tile of a tileset
A animated movable tile. This means it will transition if the location gets chanced.
Note: the id should be a unique string, if not the transition might fail every now and then.
An animated tile. The sprites of the animation must be arranged horizontally in the tileset.
animatedTile (0,0) 0 == tile (0,0)A movable tile. This means it will transition if the location gets chanced.
Note: the id should be a unique string, if not the transition might fail every now and then.
A basic tile. The first tile in a tileset is obtailed by
tile (0,0)An area of the window. Elements in the area must be of the same type. So for a tiled area contains only tiles of the same tileset.
Creates a tiled area. Elements in this area are positioned on a grid. The content consists of
A tileset. It contains the link to the image as well as the size of a tile.