Scrolling Game Development Kit UI Help Up to Edit Maps Dialog

Player Map Interactions

This is part of a series of pages describing the Edit Maps Dialog. This page describes the Player Interaction tab.

Here you can define which sprite is the player sprite (which sprite causes the map to scroll), and how this sprite can interact with map tiles using inventory. Selecting a sprite as the player sprite is not related to what controls that sprite. A player sprite can be controlled automatically or by the input device. The main features of the player sprite are that it causes the map to scroll and it is the one sprite that can interact with tiles and special functions.

To select a player sprite, you must have a sprite with the "Initial Instance" option checked. The player sprite must be created with the map, so only "Initial Instance" sprites are listed as selections in the first field. The remainder of the tab is dedicated to defining interactions between the player sprite and various categories of map tiles. The player sprite must be specified before interactions can be defined because many aspects of the interaction depend on properties of the player sprite (especially the layer on which the player sprite resides). Defining an interaction consists of entering the parameters for the interaction and then clicking the "New" button to add these parameters to the map as a new interaction definition. The arrow buttons at the bottom can be used to scroll through existing interactons.

The first field in the Map Interaction frame is used to specify a tile category which triggers the interaction. All interactions are based on a tile category, even if the interaction is only concerned with a single tile. For information on creating tile categories, see Tile Categories. The interaction is triggered whenever the player touches any tile in the category specified in this field. If the player touches multiple tiles in this category at the same time, the interaction is triggered for each tile in sequence.

The "Initially" option indicates that this interaction should only be triggered when the player initially touches the tile, and should not be triggered again unless the player stops touching the tile and then starts again. The "Continuously" option indicates that the interaction should be constantly triggered (each frame advance of the game) as long as the player continues to touch this tile and as long as the tile continues to be a member of the category. (If the tile changes to a tile not in the category, the interaction will not continue to be triggered by it.)

After these two options is a field in which you can indicate the kind of effect this interaction will have:

New as of version 1.4 is a quantity field (marked by a "# ") after the effect field described above. This quantity field allows you to specify a quantity of inventory that will be affected. Before version 1.4, this value was effectively 1 because touching a tile could only add or subtract 1 from an inventory quantity. But now you can add, subtract or require any number for the specified item. This allows you to, for instance, have a single tile representing a "package" of ammunition that adds 10 to your "ammunition" inventory item all at once. Or likewise, you could have a tile representing a "cost 50" tile which costs 50 coins in order to have it changed into another tile.

Relavent inventory item refers to an item defined in the Player Settings Dialog. For actions (listed above) that involve the inventory, this field indicates which item is involved. If "No effect on inventory" was selected, then the "Relavent inventory item" setting is irrelavent. However it is still stored with the interaction. This piece of information could be set and then used by script code if the interaction raises an event. The script code might have use for a reference to an inventory item.

"Remove tile if inventory OK" will change the map tile:

"Don't remove" will never alter the map tile in response to this interaction (perhaps this is where you can always fill up on a particular item). "Always remove" will remove the tile from the map whenever the player touches it, regardless of the player's inventory.

Below these options is a setting to indicate what the tile is changed to when it is "removed". A tile cannot simply be removed from the map because every pixel on the layer must map to *some* tile. If you want to replace the tile with background, then "0" is the appropriate value here. However, it's possible to replace this tile with any other tile when the tile is removed. The new tile could in turn trigger another interaction (if the "Continuously" option is selected). So chains of interactions could be built up on a single type of tile.

In GameDev version 1.4, it is possible to either trigger a media clip or a special function as the result of a tile interaction. This can be handy if you have a complex effect that you want repeated wherever the specified tile exists on the map (like in Mario, maybe you want a coin to pop out the top of the tile whenever you touch a question mark tile). To specify only a sound effect to play when the tile interaction activates, select the "Play media clip" option and then select a media clip from the list below. To trigger a special function, select the "Activate function" option and then select from the list below, which will now contain functions from the current map. Note that the activation parameters of the function are mostly ignored because the tile interaction acts as the activation criteria for the function. So only the Effect tab of the special function applies. When a special function is activated from a tile interaction, the "trigger point" is set to the location of the tile that caused the interaction. Certain special functions can perform actions relative to that trigger point, like creating a sprite or copying a block of tiles relative to that point. The point (more precisely) is the upper-left pixel of the tile that caused the interaction, for those who care.

Finally, the "Raise an event for this interaction" determines whether the OnTileInteraction event should be triggered whenever the player touches a tile in the specified category for this interaction. If this is checked, the X and Y coordinates of the tile (in tile coordinates, not pixels), tile value, "NewTouch" flag and Interaction index are passed to the event. The "NewTouch" flag indicates whether the player has just started touching the tile (true) or if the player was already touching it (false). The interaction index indicates the ordinal index of the interaction within the map, so the same interaction definition can be located in the script code if need be.

The New button creates a new interaction definition based on the paremeters currently entered. The Delete button deletes the current interaction (indicated in the title of the "Map Interaction" frame). The Update button updates the current interaction (indicated in the title of the "Map Interaction" frame) to the entered parameters. "<<" goes to the first interaction, "<" to the previous interaction, ">" to the next interaction, and ">>" to the last.