Use: The data-URI OR network path to image.
Note: Using network paths will cause the asset to be redownloaded to the clients if the clients cache is disabled.
type Image = String
Use: A horizontal displacement in number of pixels.
Note: Can be negative value.
type X = Int
Use: A vertical displacement in number of pixels.
Note: Can be negative value.
type Y = Int
Use: A horizontal width of an object in number of pixels.
Note: Cannot be negative.
type Width = Int
Use: A vertical height of an object in number of pixels.
Note: Cannot be negative.
type Height = Int
Use: The number of Frames in a FrameArray
Note: Cannot be negative.
type FrameCount = Int
Use: The number of screen updates that a Frames in a FrameArray will be displayed for before transitioning to the next frame.
Note: Cannot be negative.
type FramesPerSecond = Int
Use: A collection of Frames
type FrameArray = Array Image
Use: A angle in degrees.
type Deg = Int
Use: A value that uniquely identifies a in-game asset (Image or Sprite).
type AssetId = Int
Use: A value that uniquely identifies a game state.
type StateId = Int
Use: A value that uniquely identifies a TileMap.
type MapId = Int
Use: In game score
type Score = Int
Use: The height text should be in pixels when displayed on screen.
type TextHeight = Int
Use: The Size of the canvas the game will be drawn on.
type MonitorSize = Size
Use: A change in X and Y coordinates.
type Vector = Position
Use: A position relative with X and Y coordinates.
type Position = {
x :: X,
y :: Y
}
Use: A speed with direction defined by a horizontal and vertical component.
type Velocity = {
xSpeed :: Number,
ySpeed :: Number
}
Use: A collection of TileMaps
type Asset = {
mapData :: Array TileMap
}
Use: A 2D array of ScaledImages. Any cell that is Nothing
represents an empty tile.
type TileMap = Array (Array (Maybe ScaledImage))
Use: A graphical context for drawning TileMaps on a monitor with a defined Size given a Context2D
.
type DrawContext = {
ctx :: Context2D,
mapData :: Array TileMap,
monitorSize :: MonitorSize
}
Use: A Image with a defined Size and AssetId.
type ScaledImage = {
id :: AssetId,
image :: Image,
size :: Size
}
Use: A FrameArray that can be iterated through. Each of the images in the FrameArray will be scaled to the specified Size when drawn.
Note: frameIndex
cannot be negative and frameCount
should be the length of frames
.
type Sprite = {
id :: AssetId,
frames :: FrameArray,
frameIndex :: Int,
framesPerSecond :: FramesPerSecond,
frameCount :: FrameCount,
size :: Size
}
Use: An API request.
type Request = {
url :: String,
json :: String,
method :: String
}
Use: A wrapping type for an object's Width and Height.
type Size = {
width :: Width,
height :: Height
}
Use: An API request for storing a player's score and time.
type PlayerScoreCreateRequestData = {
username :: String,
score :: Int,
start :: String,
end :: String
}
Use: An API reqponse containg the details of a player's highscore.
type PlayerScore = {
username :: String,
score :: Int,
time :: String,
position :: Int
}