new Preloader(pFirstState)
The Preloader is used to set the preload page.
You can create a custom preloader extending this one and providing it to
the init function of game object.
Parameters:
| Name | Type | Description |
|---|---|---|
pFirstState |
FM.State | The first state to switch to once the preload is complete. |
- Source:
Extends
Members
-
camera :FM.Rectangle
-
Camera (limited by the screen resolution of the game).
Type:
- Inherited From:
- Source:
-
members :Array
-
Array containing every game objects of the state.
Type:
- Array
- Inherited From:
- Source:
Methods
-
add(gameObject)
-
Add a game object to the state.
Parameters:
Name Type Description gameObjectFM.GameObject The game object to add to the state. - Inherited From:
- Source:
-
centerCameraAt(xPosition, yPosition)
-
Center the camera at a specific given position.
Parameters:
Name Type Description xPositionint The target x position of the camera. yPositionint The target y position of the camera. - Inherited From:
- Source:
-
centerCameraOn(gameObject)
-
Center the camera on a specific game object.
Parameters:
Name Type Description gameObjectFM.GameObject The game object to center the camera on. - Inherited From:
- Source:
-
destroy()
-
Destroy the quad tree.
- Source:
-
draw(bufferContext, dt)
-
Draw on the preloader state.
Parameters:
Name Type Description bufferContextCanvasRenderingContext2D Context (buffer) on wich drawing is done. dtfloat Variable delta time in seconds since the last frame. - Source:
-
follow(gameObject, width, height)
-
Make an object as the scroller.
Parameters:
Name Type Description gameObjectFM.GameObject The game object to follow. widthint The width of the camera. heightint The height of the camera. - Inherited From:
- Source:
-
getGameObjectById(pId) → {FM.GameObject}
-
Get the game object which ID matches the one given.
Parameters:
Name Type Description pIdint The ID of the object to retrieve. - Inherited From:
- Source:
Returns:
The game object that corresponds or null if it finds nothing.- Type
- FM.GameObject
-
getQuad() → {FM.QuadTree}
-
Get the quad tree.
- Inherited From:
- Source:
Returns:
The quad tree containing every game object with a physic component.- Type
- FM.QuadTree
-
getScroller() → {FM.GameObject}
-
Get the object that scrolls the screen.
- Inherited From:
- Source:
Returns:
The game object that scrolls the screen.- Type
- FM.GameObject
-
getWorld() → {FM.World}
-
Get the world object.
- Inherited From:
- Source:
Returns:
The world of the game.- Type
- FM.World
-
init()
-
Init the preloader.
- Source:
-
remove(gameObject)
-
Remove an object from the state and destroy it.
Parameters:
Name Type Description gameObjectFM.GameObject The game object to remove and destroy. - Inherited From:
- Source:
-
sortByZIndex()
-
Sort the members of the state by their z-index.
- Inherited From:
- Source:
-
unFollow()
-
Delete the scroller.
- Inherited From:
- Source:
-
update(dt)
-
Update the preloader.
Parameters:
Name Type Description dtfloat The fixed delta time since the last frame. - Source:
-
updatePhysics(dt)
-
Update the game physics.
Parameters:
Name Type Description dtfloat The fixed delta time in seconds since the last frame. - Inherited From:
- Source: