| Scrolling Game Development Kit UI Help | Up to Edit Maps Dialog |
This is part of a series of pages describing the Edit Maps Dialog. This page describes the Special Functions tab.
In order to edit special functions you must have a map selected and the player sprite must have been specified. This is required because some aspects of a special function require the layer in which the player sprite resides.
Along the left side of this tab are listed the special functions defined on the selected map. This is the top level of navigation within this tab. Selecting one of these special functions loads the information for the function into the sub-tabs at the right.
Note: In version 1.1 and earlier, only functions on the player sprite's layer were listed here because the only way to activate a function was for the player (on the same layer) to touch it. The problem with this is that there was no way to edit or delete functions that may have accidentally been added to other layers. Furthermore, there is now the ability to activate any special function(s) when the game begins. So for multiple reasons, all special functions on the selected map are now listed. Functions that reside on a layer other than the player's layer are discernible by the fact that the "Action Parameters" tab hides the controls relavent to the player when such a function is selected.
The first sub-tab restricts when the special function will take effect and whether it can be activated again. The first three check boxes indicate which actions can trigger the special function.
If more than one of these boxes are checked, any of the actions can be done alone to trigger the function. (Button and Down does not require that both down and the button be pressed to activate the function, just one or the other.) The remaining boxes determine other parameters about when the function is activated:
This tab has a lot of content to support the various types of special functions that are defined in GameDev. The "Function" field at the top of this tab determines what the selected special function should do when it is activated. The information presented below the function field is specific to the selected function.

This type of function pops up a box that displays a message or image and waits for the player to press a button. The game freezes until the message is acknowledged. To display an image enter "#PIC" as the first 4 characters of the message and then enter the path and filename of a bitmap to display. A space following "#PIC" is optional, however there must be no spaces before or inside the text "#PIC" itself. The path should be relative to the path of the GDP file for the project. The image will display centered on the screen and act just like a message until the player presses a button.

This changes the player sprite to a new sprite. This could come in handy for changing the appearance or functionality of the player, or switching it to an automatically controlled sprite for a period of time while it travels from one point to another. The new sprite will continue to interact with the map as the player sprite always does. There are a few options associated with this function:

There would be little point in having multiple maps within a project if the player were not able to jump between them. This function will transport the player to another map. The current map is unloaded and the new map is initialized (default instances of sprites are created where appropriate). Then you have the option of starting the player in the default location for this map or overriding the player start position and/or sprite with one of your own choosing. Selecting "(default)" from the "As this sprite" box uses the sprite specified as the Player sprite for the map. The definition you select must be a sprite that has "Initial Instance" checked and would be automatically created when the map is initialized. If you want to override the starting position instead of using the default position for the sprite, you may check the "Set start position" box and specify an X and Y coordinate in pixels. This coordinate is given as an offset from the top left corner of the layer in which the sprite resides.
When the player switches to a new map, the inventory is retained. There may be different interactions defined on the map, but all maps are defined in terms of the same inventory. This is the reason for separating the inventory's interaction with the map (on the Player Interaction tab) from the inventory definition itself (on the Player Settings dialog).

The player can be teleported either to an absolute position or to a position offset from the player's current position. Coordinates are given in pixels. For an absolute teleport (if the "Offset" box is left unchecked) coordinates are given in pixels from the top left corner of the layer in which the player resides, and a preview of the destination location is displayed at the right. The coordinates specify where the top left corner of the sprite should end up.

This is a particularly useful function for changing a piece of the map. It copies the tiles from under another special function and puts them wherever you want. Everything must occur on the same layer as the player. It's not possible to copy tiles accross layers, or to copy areas of tiles from one place to another on a layer other than the layer where the special function was triggered. All the tiles will be copied from under the specified special function to the location specified. The location specified indicates the top left corner of where the tiles are output. The "Pick cordinates" box is not part of the special function, but rather a tool you can use to calculate coordinates. If the function being defined happens to contain the destination rectangle (aligned to one corner) you can use the Pick coordinates box to enter the coordinates necessary to copy the rectangle to the appropriate corner.
For instance you may have an "UnBlockPassage" function defined at 24,20 to 26,23 and you have an "OpenedPassage" function defined at 100,50 to 101,53 (notice the open passage is one tile narrower horizontally). "UnBlockPassage" represents the area the player can touch to activate a function that copies an image of an opened passageway into the tiles at 25,20 to 26,23. "OpenedPassage" represents this image being copied. Since 26,23 (the bottom right corner) happens to be the same for "UnBlockPassage" and for the rectangle you want to affect, you can select "Match bottom-rights" from the "Pick coordinates list" and it will enter the coordinates "25,20" for you (the top left corner of where the copy must begin to make the bottom right corners match). This tool is convenient if you don't know the coordinates of the destinaton, but you know the destination matches a corner of the function you're currently defining.

Use this function to create a new instance of a sprite based on the specified sprite definition. You can override the default start position for the sprite if you like by checking the "Set start position" box and entering a pixel coordinate. If the "Absolute" option is selected, the coordinate will be interpreted as pixels relative to the top left corner of the layer. If "Relative" is selected, the coordinate will be added to the position of the player. The top left corner of the new sprite will start at the specified offset from the top left corner of the player sprite. The "Maximum count" parameter sets a maximum on how many of the sprite the function should allow. The function will not create another instance of the sprite if the maximum number already exist. (The last parameter is new with version 1.2.)
This function does not require any parameters. Instead all the work in this case is handled in script. This is a particularly useful option as it allows you to do anything you want if the other function types do not cover the effect you want the special function to have. The Player object's "OnSpecialFunction" event is raised when the function is triggered, and the "SpecialFunction" object that was triggered is passed to the script code as a parameter.

To prevent the map from becoming over-populated with sprites you may want to make frequent use of this function. It allows you to delete one or all instances of sprites based on the specified sprite definition. Specifying a minimum will prevent all sprites from being deleted by the function; the function will only delete sprites if the minimum number will still exist. Specifying a minumum and checking the "Delete all above min." box will delete sprites until the specified number of sprites exist for that type of sprite. If the minimum is set to zero and the box is checked, all sprites of the specified type will be deleted at once.
When the parameters for a special function are complete, you must press the Update button to save them to the currently selected special function. There's one more button that may be useful in calculating some of the parameters for special functions. The button to the left of the Update button is a calculator button that will run Windows calculator. You might need this in converting between tile coordinates and pixel coordinates (by multiplying the tile coordinate by tile size or dividing pixel coordinate by tile size).