Constructor
new TileSceneChanger(spriteSheetSource, canvasObject, sceneWidth, sceneHeight, tw, th, mainChar)
Constructs a new TileSceneChanger
Name | Type | Description |
---|---|---|
spriteSheetSource |
||
canvasObject |
||
sceneWidth |
||
sceneHeight |
||
tw |
||
th |
||
mainChar |
Members
_cameraPoint
_direcs
_display
_enemyArrays
Used by addEnemyArray and getEnemyArray.
_map1
_map2
_mapNumber
_otherArrays
Used by addStoredArray and getStoredArray.
_source
_totalScenes
constructor
currentMap
currentScene
mainChar
sH
sW
tH
tW
Methods
add5Scenes(map2DArray, map2DArray2, map2DArray3, map2DArray4, map2DArray5)
Adds up to 5 scenes to _totalScenes
Name | Type | Description |
---|---|---|
map2DArray |
||
map2DArray2 |
||
map2DArray3 |
||
map2DArray4 |
||
map2DArray5 |
addEnemyArray(arr, scene)
Adds a enemy Array
Name | Type | Description |
---|---|---|
arr |
Array | |
scene |
Number |
addScene(map2DArray)
These methods populate the ._totalScenes array with clones of the arrays you pass in. the ._totalScenes array should not be handled directly. Use referenceScene() if you need to reference scenes you add, the reference index will be in the order you place them starting from 1.
Name | Type | Description |
---|---|---|
map2DArray |
addStoredArray(arr, scene)
Adds a stored array. Retreve stored Arrays with getStoredArray
Name | Type | Description |
---|---|---|
arr |
Array | An Array to store. |
scene |
Number | Index to store to, default is currentScene. |
changeCurrentMap(mapInteger)
Changes the currentMap. If _map1 or _map2 is defined they will be used, otherwise the map is _totalScenes[mapInteger]
Name | Type | Description |
---|---|---|
mapInteger |
Number | The map to change to. |
changeScene(mapInteger, direction, camera, faMethod, faMethodObject, directScene, dontResetCameraX, dontResetCameraY, dontUpdateEnemyMaps, frameTime, ts, tweenType)
This method changes which map is being used and then blits it onto the canvasObject passed during construction of the Class. It also sets the mainChars ._map and any associated MapMovers/Travelers or SceneryObjects ._map property. And it will reset the camera as needed.
Name | Type | Description |
---|---|---|
mapInteger |
the map to change to. 0 to change by added scenes and direction, 1 to change to the ._map1 of this class, 2 to change to ._map2 of this class. |
|
direction |
the direction the player is going; "left" "right" "down" "up" or 0 1 2 3 |
|
camera |
BasicCamera | a reference to the BasicCamera that is being used |
faMethod |
String | a String of the method name to call during BlitMath.dispatchFunctionAssignments. |
faMethodObject |
Object | the Object that contains the faMethod, normally the .game static Object for example from stage nine of the platformer tutorial. |
directScene |
Number | |
dontResetCameraX |
Boolean | |
dontResetCameraY |
Boolean | |
dontUpdateEnemyMaps |
Boolean | |
frameTime |
Number | |
ts |
Number | |
tweenType |
String |
changeSceneEnemies(scene)
Changes the current enemy Array being referrenced.
Name | Type | Description |
---|---|---|
scene |
changeSceneryObjects(scene)
Changes the current scenery Array being referenced.
Name | Type | Description |
---|---|---|
scene |
clearAllArrays()
clears _totalScenes, _otherArrays and _enemyArrays
defineMap1(map2DArray)
These methods use BlitMath.cloneMultiArray to clone the array you pass to them. The array passed remains a separate array, the method does not create a reference to the array passed in. Thereby ._map1 and ._map2 are unique until defineMap1/2 is called again ._map1 and ._map2 should never be set directly.
Name | Type | Description |
---|---|---|
map2DArray |
Array |
defineMap2(map2DArray)
Defines _map2 see defineMap1.
Name | Type | Description |
---|---|---|
map2DArray |
Array |
- See:
-
- defineMap1
getEnemyArray(scene) → {Array}
References a enemy Array.
Name | Type | Description |
---|---|---|
scene |
Number |
- Type
- Array
getStoredArray(scene) → {Array}
Returns a refence to a stored array stored with addStoredArray.
Name | Type | Description |
---|---|---|
scene |
Number |
- Type
- Array
referenceScene(referenceIndex)
Returns a reference to the scenes map.
Name | Type | Description |
---|---|---|
referenceIndex |
sceneryObjectSceneChange(sceneryObject, sceneryArray, limitLeft, limitRight, limitUp, limitDown) → {Number}
allow objects to be thrown into the next/previous scene
Name | Type | Description |
---|---|---|
sceneryObject |
SceneryObject | |
sceneryArray |
Array | |
limitLeft |
Number | |
limitRight |
Number | |
limitUp |
Number | |
limitDown |
Number |
Returns 1 if the object changed scene.
- Type
- Number