Advertisement
Guest User

inventory - Create Event

a guest
Jan 22nd, 2018
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. /// @description Add Later
  2.  
  3. depth = -1; //Draw inventory above lighting
  4. scale = 2;
  5. show_inventory = false;
  6. inv_alpha = .5;
  7.  
  8. inv_slots = 16; // Amount of slots in the inventory
  9. inv_slots_width = 8; // Amount of slots along the width
  10. inv_slots_height = 3; // Amount of slots along the height
  11.  
  12. selected_slot = 0;
  13. pickup_slot = -1;
  14. m_slot_x = 0;
  15. m_slot_y = 0;
  16.  
  17. x_buffer = 2; // The space between two slots on the x
  18. y_buffer = 4; // The space between two slots on the y
  19.  
  20. gui_width = display_get_gui_width();
  21. gui_height = display_get_gui_height();
  22.  
  23. s_inv_ui = s_inventory_ui;
  24. s_inv_items = s_inventory_items;
  25. cell_size = 32;
  26.  
  27. s_inv_items_columns = sprite_get_width(s_inv_items)/cell_size; //Get the amount of inventory slots per column
  28. s_inv_items_rows = sprite_get_height(s_inv_items)/cell_size; //Get the amount of inventory slots per row
  29.  
  30. inv_ui_width = 288;
  31. inv_ui_height = 192;
  32.  
  33. inv_ui_x = (gui_width/2) - (inv_ui_width/2 * scale);
  34. inv_ui_y = (gui_height/2) - (inv_ui_height/2 * scale);
  35.  
  36. info_x = inv_ui_x + 13 * scale;
  37. info_y = inv_ui_y + 13 * scale;
  38.  
  39. slots_x = inv_ui_x + 9 * scale;
  40. slots_y = inv_ui_y + (40 * scale);
  41.  
  42. // ----- Player Info
  43.  
  44. ds_player_info = ds_grid_create(2, 4);
  45. ds_player_info[# 0, 0] = "Aurum";
  46. ds_player_info[# 0, 1] = "Argenti";
  47. ds_player_info[# 0, 2] = "Centum";
  48. ds_player_info[# 0, 3] = "Name";
  49. ds_player_info[# 1, 0] = 0;
  50. ds_player_info[# 1, 1] = 0;
  51. ds_player_info[# 1, 2] = 40;
  52. ds_player_info[# 1, 3] = "PlayerName";
  53.  
  54. // ----- Inventory
  55.  
  56. ds_inventory = ds_grid_create(2, inv_slots);
  57.  
  58. // ----- Items
  59. enum item {
  60. none = 0,
  61. tomato = 1,
  62. potato = 2,
  63. carrot = 3,
  64. artichoke = 4,
  65. chilli = 5,
  66. gourd = 6,
  67. corn = 7,
  68. wood = 8,
  69. stone = 9,
  70. bucket = 10,
  71. chair = 11,
  72. picture = 12,
  73. axe = 13,
  74. potion = 14,
  75. starfish = 15,
  76. mushroom = 16,
  77. height = 17, //Move this down on new entry creation, it tells the game how many entries there are.
  78. }
  79.  
  80.  
  81. // Randomly Fill the Inventory
  82. var yy = 0; repeat(inv_slots) {
  83. ds_inventory[# 0, yy] = irandom_range(1, item.height-1);
  84. ds_inventory[# 1, yy] = irandom_range(1, 10);
  85. show_debug_message("[INFO] A random Item was added to Inventory");
  86. yy++;
  87. }
  88.  
  89. show_debug_message("[INFO] Inventory has been filled");
  90. show_debug_message("[INFO] Inventory Initialization finished");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement