A simple inventory can be made using a DS List.
/// Create event
inventory_list = ds_list_create();
/// Clean Up event (Always destroy data structures!)
ds_list_destroy(inventory_list);
You can add your items into this list. Let’s say your items are numbered (0
for Apple, 1
for Orange, 2
for Wood, etc.)
You can use Enums to store your item IDs:
enum ITEM {
APPLE = 0,
ORANGE = 1,
WOOD = 2
}
These items (which are really numbers) can be added into the inventory list.
/// Collision event with "oApple"
ds_list_add(inventory_list, ITEM.APPLE);
instance_destroy(other); // Destroy the Apple instance
Similar: