This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
item_pickup_tutorial [2018/03/07 20:42] – justin | item_pickup_tutorial [2018/03/07 20:58] (current) – justin | ||
---|---|---|---|
Line 1: | Line 1: | ||
======Item Pickups====== | ======Item Pickups====== | ||
- | |||
- | (WIP) | ||
- | |||
This tutorial will explain how to set up map [[object|objects]] as [[item|items]] for the [[player_character|player]] to pick up, for example a key that the [[player_character|player]] can pick up by walking into/over it and then use to open a door or treasure chest. | This tutorial will explain how to set up map [[object|objects]] as [[item|items]] for the [[player_character|player]] to pick up, for example a key that the [[player_character|player]] can pick up by walking into/over it and then use to open a door or treasure chest. | ||
Line 23: | Line 20: | ||
{{: | {{: | ||
- | Remember the name you used for your item (including case) as it will be referenced in a [[quick script]] later on. Click the " | + | Remember the name you used for your item (including case) as it will be referenced in a [[quick script]] later on. Click the " |
=====Creating a Sound Effect===== | =====Creating a Sound Effect===== | ||
- | Optionally, you can create a [[sound|sound effect]] for the game to play when the [[item]] is picked up by the [[player_character|player]]. To do so, click the [[sound_fx_generator||Sound FX Generator]] button at the top, then click one of the presets along the left to find a [[sound]] that goes well with the [[item]]. In this example, the " | + | Optionally, you can create a [[sound|sound effect]] for the game to play when the [[item]] is picked up by the [[player_character|player]]. To do so, click the [[Sound FX Generator]] button at the top, then click one of the presets along the left to find a [[sound]] that goes well with the [[item]]. In this example, the " |
{{: | {{: | ||
Line 37: | Line 34: | ||
{{: | {{: | ||
- | Switch into " | + | Switch into " |
{{: | {{: | ||
Line 60: | Line 57: | ||
</ | </ | ||
- | This line removes the [[script]] from the [[entity]] that activated it, in this case the [[tile]] that the [[player_character|player]] stepped onto. This is to prevent the [[script]] from being activated more than once after it's triggered the first time. | + | This line removes the [[script]] from the [[entity]] that activated it (" |
<code lua> | <code lua> | ||
Line 66: | Line 63: | ||
</ | </ | ||
- | This line removes the physical key [[object]] from the scene by referring to the unique [[entity]] ID we assigned to the key earlier on in the [[Map Editor]]. | + | This line removes the physical key [[object]] from the scene by referring to the unique [[entity]] ID we assigned to the key earlier on in the [[Map Editor]]. The ID inside the quotes should exactly match the ID that was assigned to the [[object]] from its [[Entity Properties]] dialog. |
<code lua> | <code lua> | ||
Line 72: | Line 69: | ||
</ | </ | ||
- | This line plays the [[sound|sound effect]] named " | + | This line plays the [[sound|sound effect]] named " |
<code lua> | <code lua> | ||
Line 78: | Line 75: | ||
</ | </ | ||
- | Note that this line doesn' | + | This line puts the [[item]] named "Gold Key" into the [[player_character|player' |
- | =====Testing | + | Click the " |
- | Finished! Save map and export | + | =====Testing the Pickup In-Game===== |
+ | [[exporting_your_game|Export the game]] to try out your new [[item]] pickup. The [[player_character|player]] should | ||
{{: | {{: | ||