Noah Petherbridge
c3d7348843
* Added an inventory system for actors as a replacement to the arbitrary key/value data store. Colored keys now add themselves to the player's inventory, and colored doors check the inventory. * Inventory is a map[string]int between doodad filenames (red-key.doodad) and quantity (0 for key items/unlimited qty). * API methods to add and remove inventory. * Items HUD appears in Play Mode in lower-left corner showing doodad sprites of all the items in the Player's inventory.
11 lines
183 B
JavaScript
11 lines
183 B
JavaScript
function main() {
|
|
var color = Self.Doodad.Tag("color");
|
|
|
|
Events.OnCollide(function(e) {
|
|
if (e.Settled) {
|
|
e.Actor.AddItem(Self.Doodad.Filename, 0);
|
|
Self.Destroy();
|
|
}
|
|
})
|
|
}
|