Map Editor |
This screen allows you to edit the tiles, sprites and coordinates of plans contained within a layer of a map. To use the map editor, double-click on the "Editor" node inside any layer node in the project tree, or select it and activate it from the menu.
When a sprite, plan or coordinate is selected, this command will delete it. This command is worded differently depending on the active tab and last selected object.
When turned on and placing a sprite or coordinate on the layer, this will ensure that it is placed at the top left corner of a tile. Rectangles associated with plan coordinates are always reduced in size by one pixel (in each dimension) so that they exactly cover the contained tiles (when snap to tiles is used) rather than extending one pixel into the neighboring tiles.
Add a new plan to the layer. This accomplishes the same thing as adding a plan from the project tree, except the plan editor is not displayed. The plan is added even if the "Plans" tab is not active. The new plan is assigned a default name based on the map name (and numbered in case multiple plans are created with default names). To add coordinates to the new plan, select it on the Plans tab, and click in the editor's main layer view. To change other properties, refer to the grid in the bottom left corner. To edit the behavior assigned to the plan, see "Selected Plan Details" below.
Display the plan editor for the currently selected plan. The plan editor edits the rules associated with the plan whereas the map editor can only edit the coordinates and variables associated with a plan. (Plan variables are defined in PlanBase.cs in the source code editor.)
Scrolls the main layer view so the selected sprite or plan coordinate is visible (if a plan is selected, but not coordinate, the view will scroll to the first coordinate). This is useful when you want to select a sprite or plan by name in the list on the left, and quickly scroll to it. Double clicking a sprite, plan or coordinate will automatically activate this command.
Sort the list of plan names on the Plans tab alphabetically.
Sort the list of sprite names on the Sprites tab alphabetically.
There is only one command unique to the Map Editor available in the view menu.
Causes an outline to be drawn around the edges of other layers in order to see where the edges are in relation to the layer currently being edited.
Forces the size of the map editor window to show the same portion of the map that will be displayed when playing the game. This ensures that the way parallax scrolling layers overlap looks the same in the editor as it does when playing, and no regions outside the defined scrolling area are displayed.
If a foreground layer is obstructing the layer you are editing, you can toggle the visibility of individual layers in this menu. (For that matter, you can toggle them for any other reason too!)
When this tab is active, you can edit the tiles on the layer.
At the top of the Tiles tab is a dropdown list of tile categories. Use this if you have many tiles in the tileset and don't want to have to search so many tiles for the tile you want to place. This does nothing other than filter the list of tiles visible below. Notice, however, that when extra large tiles are included in the list, it causes all the tiles to be spaced out to equivalent sizes, so creating categories to separate large tiles from small tiles may be useful to allow a more compact list when placing smaller tiles.
If no category is selected, all tiles in the tileset are displayed. But the number of tiles displayed in that circumstance depends on a couple other factors. Although a layer can technically use any of the 256 tile values for a 1-byte tile, or any of the 32,768 tile values for a 2-byte tile, it would be cumbersome to display 32,768 tiles in the tile selector when only a few are of interest. The tile selector could display all 32,768 values because any undefined tile simply refers to the frame by the same number, and once the frame numbers have been exhausted, the indexing wraps back to the first frame. But to limit the number of tiles displayed, the following rules are used:
The main portion of the Tiles tab is dedicated to displaying a list of tiles. To add tiles to the map, simply click on a tile here and then click on the map where you want to place the tile.
The status bar contains many pieces of information relevant to placing tiles:
When this tab is active, you can select, move, edit, add and delete sprites. A sprite is a visual element on a layer that can move around according to a set of rules or based on player input, and can interact with other sprites or tiles on the layer.
A small toolbar appears at the top of this page to provide easily visible shortcuts to relevant operations:
When this option is selected, the sprites tab is in a mode that allows you to select existing sprites by clicking on them in a list or by clicking on them in the main layer editor view. When a sprite is selected, its properties appear in a grid at the lower left corner of the window, and can be changed directly. Selected sprites can also be easily moved to a new location by dragging them in the main layer view. Multiple sprites can be selected by holding the Ctrl key while clicking. If the mouse is clicked on an area of the map where there are no sprites, all sprites will be de-selected.
Tip: When multiple sprites are selected, you can still use the properties window in the lower left. Setting a property when multiple sprites are selected sets the property for all selected sprites at once. Properties that are the same for all selected sprites are displayed. Properties that are different for some selected sprites are left blank and not changed unless a new value is entered.
When this option is selected, the sprites tab is in a mode that allows you to create new sprites and add them to the current layer. In this mode, instead of displaying a list of existing sprites, two other elements are displayed. First is a dropdown list of sprite categories, which works very similarly to the tile category selector on the Tiles tab. And second is a selection of sprite types, which you can add to the current layer. Adding a sprite to the layer is as easy as adding a tile. Click on one and then click on the layer. There are, however, a few additional options and considerations before placing the sprite on the layer. Before adding the sprite to the layer, the properties of the new sprite can be edited in the properties window at the bottom. But it's not necessary to set any properties before placing a sprite because they can also all be changed (in Select Sprites mode) after the sprite is added. Each new sprite that is added is assigned a default name based on the sprite definition name and a uniquely identifying number. For more information about the sprite's properties, see Sprite Properties below.
At the bottom of the sprites tab is a list of properties that can be set or altered for the currently active sprite. In Select Sprites mode, this represents the properties of the selected sprite or sprites. In Add Sprites mode, this represents the properties of the sprite about to be added. Below are details about the various properties that are displayed here.
Active | The default of True makes the sprite automatically visible and active as soon as the map becomes current. Active Sprites are drawn and process their rules whereas inactive sprites are not drawn and don't process rules. Furthermore, any rule that tries to operate on an inactive sprite will display an error message in debug mode. |
CurrentFrame | Each state in a sprite may consist of multiple frames of animation. This property determines which frame the sprite initially displays. |
CurrentState | Each sprite has multiple states in which it can exist. This property determines in which state the sprite initially exists. |
DefinitionName | This is displayed for informational purposes and reflects the sprite definition on which the sprite is based. This might be important if you have many sprites that can look similar or identical, but behave according to different rules. |
DX | The horizontal velocity of the sprite in pixels per frame. This may be a fractional value. |
DY | The vertical velocity of the sprite in pixels per frame. This may be a fractional value. |
ModulateAlpha | Controls sprite-level transparency. This is a number from 0 (invisible) to 255 (opaque) that affects the visibility level of the sprite. The value is combined with the ModulateAlpha value of the frames that make up the sprite, so if you have a frame with a ModulateAlpha value of 128 (50%) in a sprite with a ModulateAlpha of 128 (50%), the final ModulateAlpha level for that frame will be 64 (25%). |
ModulateBlue | Controls the appearance of blue at the sprite level. This is a number from 0 (no blue) to 255 (original amount of blue) and is merged with the ModulateBlue value of the frames. |
ModulateGreen | Controls the appearance of green at the sprite level. This is a number from 0 (no green) to 255 (original amount of green) and is merged with the ModulateGreen value of the frames. |
ModulateRed | Controls the appearance of red at the sprite level. This is a number from 0 (no red) to 255 (original amount of red) and is merged with the ModulateRed value of the frames. |
Name | Assigns a unique name to this individual sprite instance based on the sprite definition name and a uniquely identifying number within the layer. A sprite name must be unique among all the sprites within the same layer. Names must begin with a letter and contain only letters, digits and spaces. |
Priority | Determines the order that sprites are drawn. Lower numbers are drawn first, and therefore appear behind sprites with higher proprity numbers. This number also determines when a sprite is drawn relative to the tiles in the layer. If the layer's priority value is lower than that of the sprite, the sprite will draw in front of the tiles. If the layer's priority value is higher than that of the sprite, the sprite will draw behind the tiles. If the layer's priority value is equal to that of the sprite, the sprite will be "interleaved" with the rows of tiles on the layer. Since the default priority of a layer is 0, and you usually don't want to interleave the sprites with the layer's tiles, this value should usually be a 1 or higher. See more information about priority in the Layer Manager. If two sprites have the same priority, the order in which they will be drawn is arbitrarily assigned when the project is compiled, but will never change after that. |
Solidity | Determines which tiles this sprite sees as solid and various other shapes. If this is not set, the sprite will not be blocked by any tiles. |
X | The horizontal position of the sprite within the layer (the number of pixels between the left edge of the sprite and the left edge of the layer). This can be edited manually, but it's easier to place or drag the sprite in the main layer view. |
Y | The vertical position of the sprite within the layer (the number of pixels between the top of the sprite and the top of the layer). This can be edited manually, but it's easier to place or drag the sprite in the main layer view. |
(Sprite Parameters) | Additional parameters can be added to sprites on the Parameters tab of the Sprite Definition editor. They will appear here so that you can specify initial values for each of these parameters on each instance of each sprite. Sprite parameters are always integers, which means they can only be a numeric value from -2147483648 to 2147483647. |
Some extra properties in the Lighting category are available when a sprite based on the LightSpriteBase base class is selected.
LightAimX | Horizontal offset relative to this sprite's location at which this light source points. Positive values point right, and negative values point left. Aim is mostly noticeable when LightApertureFocus is used to focus the light in one direction. However, if aim is not set, the light will not be visible. The size of the aim vector does not matter because it is normalized to a unit vector; only the direction matters. |
LightAimY | Vertical offset relative to this sprite's location at which this light source points. Positive values point down, and negative values point up. Aim is mostly noticeable when LightApertureFocus is used to focus the light in one direction. However, if aim is not set, the light will not be visible. The size of the aim vector does not matter because it is normalized to a unit vector; only the direction matters. |
LightAimZ | Depth offset relative to this sprite's location at which this light source points. Positive values point from the layer toward the viewer, and negative values point from the viewer toward the layer, so negative numbers would be more common for this value because light sources are generally positioned (with LightZ) on the same side of the layer as the viewer. Aim is mostly noticeable when LightApertureFocus is used to focus the light in one direction. However, if aim is not set, the light will not be visible. The size of the aim vector does not matter because it is normalized to a unit vector; only the direction matters. |
LightApertureFocus | Determines whether and how light is focused in a particular direction. A value of 0 causes light to spread over a 180-degree cone (in other words, from a plane) in the direction determined by LightAimX, LightAimY and LightAimZ. Values near 1 (but less) focus the light into a narrow beam. Negative values widen the spread. Negative 1 sheds light in all directions. |
LightApertureSoftness | Determines how crisp the edges of the light cone are for lights directed by LightApertureFocus. This value is essentially added to LightApertureFocus to generate two light cones that form a gradient from lit to unlit. |
LightConstantFalloff | Works in conjunction with LightLinearFalloff and LightQuadraticFalloff to determine how this light source extends over distance. The sum of these 3 values should be about 1.0. Lower values extend more light and higher values extend less light. See Google for details. |
LightLinearFalloff | Works in conjunction with LightConstantFalloff and LightQuadraticFalloff to determine how this light source extends over distance. The sum of these 3 values should be about 1.0. Lower values extend more light and higher values extend less light. See Google for details. |
LightQuadraticFalloff | Works in conjunction with LightConstantFalloff and LightLinearFalloff to determine how this light source extends over distance. The sum of these 3 values should be about 1.0. Lower values extend more light and higher values extend less light. See Google for details. |
LightZ | Depth position of this light source relative to the layer where the sprite resides. Since scrolling game sprites generally don't have a depth coordinate, but depth is important for lighting, this property is helpful in determining how light shines on the map. Common values for this property fall approximately in the range of 0.1 to 10.0. Larger values position the light farther from the map, which is useful when illuminating a large area, for example, to provide ambient light. This value combined with the X and Y values form a 3D coordinate, which work with LightAimX, LightAimY and LightAimZ to determine the light's location and direction. |
A number of values in the status bar are of interest when using the sprites tab:
When this tab is active you can create and delete plans, add, delete and edit coordinates contained in plans, change the basic properties of a plan, or change the properties of coordinates within the plan.
Plans are used to affect the behavior of sprites and other elements. Plans can consist of:
Plans can contain rules without any coordinates, or could contain coordinates without any rules (maybe to be referenced by another plan). The map editor focuses on the management of the coordinates in plans. To manage the rules within plans, see the plan editor.
A number of commands are displayed in a toolbar at the top of the Plans page for easy access to relevant operations.
All plans on the current layer are represented as dashed lines leading from point to point, beginning with a round anchor and ending with a pointed arrow. Plans with only two coordinates will show a rectangle indicating that the plan can be applied to rules that require a rectangular area as opposed to a series of coordinates.
Only display the selected plan. This could improve performance or visibility if there are many plans.
Displays the X and Y coordinates of each point contained within the plan. Coordinates can be selected in this list or (when "Select Coordinates" is selected) by clicking on them in the main layer view. The currently selected coordinate(s) are highlighted in this list and marked with a red dot in the main layer view. The properties of the selected coordinate(s) can be edited in the grid at the bottom.
When this option is active, clicking in the main layer view will add a coordinate to the end of the path. No dragging is necessary, just click once to add each point. As the mouse moves over the layer, an arrow or point will follow the mouse indicating where the next point would be added when you click. If you move the mouse out of the layer view, the path will be displayed as stored (it will stop showing the "proposed point" following the mouse). Once placed, a coordinate can only be moved by typing a new value in its X and Y properties. See below for more about editing and deleting coordinates after they have been added.
To edit or delete existing coordinates, you can either start by selecting a coordinate in the coordinate list, or you can switch to "Select Coordinates" mode and click on a coordinate in the main layer view. The selected coordinate is highlighted in the coordinate list and marked with a red dot in the layer view. multiple coordinates can be selected by holding Ctrl while selecting, but only coordinates from a single plan can be selected at once. The properties of the selected coordinate(s) are displayed in the grid in the lower left corner. The currently selected coordinate(s) can be deleted with the delete key, or by selecting "Delete Selected Coordinates" from the Edit menu. Note that if you select a plan after selecting a coordinate, then you can only edit and delete the plan as a whole. The last selected object (whether a plan or a coordinate) determines what can be deleted or edited.
If the last object selected was a plan, then this grid displays the properties of the plan. If the last selected object was a coordinate, then this grid displays the properties of the coordinate. A plan only has a few properties:
The properties of a coordinate are:
A coordinate can only be moved by typing new values for the X and Y properties in the property grid. Use the status bar to help locate a new location. Multiple coordinates or plans can be updated at once by holding Ctrl while selecting multiple objects.
A number of values in the status bar are of interest when using the plans tab:
The Tools tab provides some convenient features not available elsewhere in the map editor.
Allows you to select and copy a block of tiles. After dragging a rectangle with this command, the editor will automatically switch to the Paste tool.
Paste a block of tiles copied with the copy command. Although the preview of the paste may show the tiles being merged in transparent areas, when you actually click, all the tiles in the block will replace the tiles on the layer, causing existing tiles in the layer to be removed.
This is similar to paste, but tiles with a value of 0 will not be pasted. This assumes that tile 0 is your background tile.