ParallaxSingleton
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
The layer class. |
|
public |
version: * The version of the module. |
Private Members | ||
private |
Weakmap to store info on instances used in this module. |
|
private |
An set of instances that use the parallax system. |
|
private |
The last position of the camera. |
|
private |
The logger module this module uses to log errors / logs |
Method Summary
Public Methods | ||
public |
Adds an instance to the parallax system. |
|
public |
handleOnRelocated(pInstance: Diob | MapObject, pChildren: MapObject[]) Handles the onRelocated event for instances. |
|
public |
Removes an instance to the parallax system. |
|
public |
Updates the parallax system. |
Private Methods | ||
private |
Initializes this instance. |
Public Constructors
public constructor() source
Public Members
Private Members
Public Methods
public add(pInstance: Object, pConfig: Object, pX: number, pY: number, pMap: string) source
Adds an instance to the parallax system. Call this first and then add your instance to the map.
Params:
Name | Type | Attribute | Description |
pInstance | Object | The instance to add to the parallax system. |
|
pConfig | Object | The parallax info that tells this module how to control this instance. |
|
pX | number |
|
The x position this instance will start at. |
pY | number |
|
The y position this instance will start at. |
pMap | string |
|
The map this instance will start at. The following is how the speed of the parallax multipliers are factored in.(x | y) < 1 = faster behind the camera eg: (-> Player goes this way = Instance goes this way <-) |
public handleOnRelocated(pInstance: Diob | MapObject, pChildren: MapObject[]) source
Handles the onRelocated event for instances. Moves their children in relativity to their position.
Params:
Name | Type | Attribute | Description |
pInstance | Diob | MapObject | The instance to handle the event for. |
|
pChildren | MapObject[] | An array of children belonging to the instance. |
public remove(pInstance: Object) source
Removes an instance to the parallax system.
Params:
Name | Type | Attribute | Description |
pInstance | Object | The instance to remove to the parallax system. |
Private Methods
private init(pInstance: Object, pConfig: Object, pX: number, pY: number, pMap: string) source
Initializes this instance.
Params:
Name | Type | Attribute | Description |
pInstance | Object | The instance to initialize. |
|
pConfig | Object | The parallax info that tells this module how to control this instance. |
|
pX | number | The x position this parallax will start at. |
|
pY | number | The y position this parallax will start at. |
|
pMap | string | The map this instance will start at. |