The GJumper virtual console is a template for grid based games. It has the following Properties:
Here is a list of games that use this virtual console:
You can find the source files in the examples folder.
{ data : data
, grid : Grid.Wrapped.Grid square
, player : ( Basics.Int
, Basics.Int )
}
The Model
of a GJumper Game contains a player position, a grid and some
aditional data.
You can define a square
how ever you want. Any information, that can not be
stored in the grid should be part of the data
.
At any point in time a game is either Ongoing
, Won
or Lost
. Once the game is
done, the game can be reset by pressing a buttion, some of the data can be also
transfered from one game session to another (like a level counter).
define : { init : Maybe data -> Random.Generator (InitModel square data), isSolid : square -> Basics.Bool, tick : GameData square data -> Random.Generator ( GameData square data, Status ), view : data -> View square, title : String, imgSize : Basics.Int, gameWon : List ( ( Basics.Float, Basics.Float ), PixelEngine.Image.Image Basics.Never ), gameOver : List ( ( Basics.Float, Basics.Float ), PixelEngine.Image.Image Basics.Never ) } -> Game square data
The main function of the game console.
{ data : data
, player : ( Basics.Int
, Basics.Int )
, distribution : data -> ( ( Basics.Float
, Maybe square )
, List ( Basics.Float
, Maybe square ) )
, fixed : data -> List ( Basics.Int
, square )
, level : data -> List (List (Maybe square))
, rows : Basics.Int
, columns : Basics.Int
}
The initial model.
(float,Nothing)
to the list where float
is higher then 0.Core.View square
The view of the model
view : { player : PixelEngine.Tile.Tile Basics.Never, square : square -> PixelEngine.Tile.Tile Basics.Never } -> PixelEngine.Tile.Tileset -> PixelEngine.Background -> View square
Specifies how things look.
It uses the Tile from Orasund/pixelengine.
withGui : Header -> Footer -> PixelEngine.Background -> View square -> View square
Adds a Gui to the view.
footer : List ( Basics.Float, PixelEngine.Image.Image Basics.Never ) -> List ( Basics.Float, PixelEngine.Image.Image Basics.Never ) -> List ( Basics.Float, PixelEngine.Image.Image Basics.Never ) -> Footer
A footer. the floats specify the x position. It must be between 0 and 16*imgSize. The y position depends on the list (first list has y=0, second list has y=1 and third has y = 2)
header : List ( Basics.Float, PixelEngine.Image.Image Basics.Never ) -> Header
A header, the floats specify the x position. It must be between 0 and 16*imgSize.
Core.Footer
A Footer
Core.Header
A header
PixelEngine () (Model square model) Msg
The type of a game.