Skip to content

Creating Obstructions

Adam Kissaglis edited this page Nov 11, 2020 · 4 revisions

Creating Obstructions

Obstructions

We have the option to add Obstructions to each Area, these can walls or boulders etc.

These can be used to create paths for the NPCs and Enemies to follow or chase the Player Character through.

Each Obstruction cannot be interacted with and will block passage of the Player Character or Characters.

Adding an Obstruction to an Area

We add Obstructions in the same way we add other Grid Elements to the area, by building an object which will be added to the areaElements array the Area file we're adding it to.

Below is an example of the object structure for an obstruction:

 { type: ElementClass.object, elementProperties: { name: "Straight Wall", startingDirection: Direction.S, direction: Direction.S, isInteractive: false, imageFileName: "wall-straight.png", }, startingPositionX: 3, startingPositionY: "a", }, 

Property details

Property name Property type Property example value Description
type ElementClass ElementClass.object The type of Grid Element, in this case it will always be object. See ElementClass
elementProperties object n/a Contains data about the Object.
elementProperties.name string "Straight Wall" The name which will be referenced in-game.
elementProperties.startingDirection Direction Direction.S The intial Direction the Object will be facing when placed into the Area.
elementProperties.isInteractive boolean false Determines if the Player Character can Interact with the Object. In this case an Obstruction will always be false.
elementProperties.imageFileName string "wall-straight.png" The filename used to display the Object on screen (file must be 80x80 pixels and .png format).
startingPositionY string "d" The "Y" coordinate used to determine the starting Grid Location.
startingPositionX number 7 The "X" coordinate used to determine the starting Grid Location.

How to add image files

All Obstruction images must be 80 pixels tall and 80 pixels wide (80x80) and must be of format .png.

Copy or move your image file into the directory Elements Image Files and the filename should match exactly the imageFilename property in the key item object you're creating, as above.

Clone this wiki locally