Repository navigation
new Map(vertices)
Arguments
-
object(index: Vector): Accepts a dictionary of vertices of the form
index: vectorwhereindexis a unique numeric id andvectoris an instance ofTHREE.Vector3.
Returns
A new map object.
map.link(from, to, direction)
Links two tiles together so that the player can cross from one tile to the other.
Arguments
-
id: The
indexof the tile that is being linked from -
id: The
indexof the tile that is being linked to - string('north', 'south', 'east', 'west'): The direction the tiles are being connected
Returns
None.
map.setTile(index, mesh)
Sets the mesh of the tile.
Arguments
-
id: The
indexof the tile that is being set. - THREE.Mesh: The mesh object to be applied to the tile.
Returns
None
map.onInteract(index, options)
options = {
type: string
callback: function
}
Binds an interaction object to a tile with id index.
Arguments
-
id: The
indexof the tile that is being set. - obj(type=string, callback = function(n)): The type of interaction and the callback that is triggered when the interaction is invoked.
Options
- type='click': Interaction is invoked upon clicking tile.
- type='trigger': Interaction is invoked upon stepping on tile.
-
callback = function(n): The function that is invoked upon interaction.
nrefers to the number of times the interaction has been invoked.
Returns
None
map.freezeInteraction(index)
Freezes the tile so that the player cannot interact with it.
Arguments
-
id: The
indexof the tile that is to be frozen.
Returns
None
map.unfreezeInteraction(index)
Unfreezes the tile so that the player can interact with it. Usually called after map.freezeInteraction.
Arguments
-
id: The
indexof the tile that is to be unfrozen.
Returns
None
map.declareAnimating(array)
Declares the vertices that will be animating. All animating vertices MUST be declared if not they will not animate.
Arguments
-
array: An array of
indexvalues.
Returns
None
map.makeAnimation(index, options)
options = {
description: string
loop: function
trigger: function
}
Binds an animation to a tile with id index.
Arguments
-
id: The
indexof the tile that is being set. - obj: Specifies the options for the animation
Options
- description=string: Describes the animation.
-
loop=function(vertex, t): Animates the tile object
vertexindefinitely given a global clock countert.tis counted in seconds. -
trigger=function(vertex, t, controls): Animates the tile object
vertexonce whencontrols.triggeredis set totrue. The local clocktcounts the number of seconds after that has happened. Need to callcontrols.done()after the animation is complete to reset the trigger.
Returns
None
map.setClones(object)
object = {
id: clone1
id: clone2
...
}
clone1 = {
name: string
description: string
facing: direction
vertex: id
}
...
Instantiates clones onto the map at tiles vertex facing direction direction.
Example
map.setClones
0:
name: "Fooman"
description: "Has no distinguishing properties"
facing: "north"
vertex: 0
1:
name: "Barman"
description: "Works at a tavern"
facing: "north"
vertex: 8
window.narrator.narrate(string)
Creates a narration to the player.
Arguments
- string: The message that is to be displayed/narrated to the reader.
Returns
None