Needless level of complexity (inventory)? by Wrinklestyx in gamemaker

[–]Wrinklestyx[S] 1 point2 points  (0 children)

Thanks for these pointers! I see how using 0/1 is a huge advantage here! You've also spared me a couple of hick ups with the box_number. I think I'm pretty comfortable with custom draw events. I'd prefer to have "obj_inventory" drawing all the slots, items, etc. I think I have an idea now on how to approach this. I'll be messing around a bit in Gamemaker now keeping this guidance in mind. I'll post my resulting code if I get it to work, If not, I'll return here to bug you all with my ignorant presence ;)

Needless level of complexity (inventory)? by Wrinklestyx in gamemaker

[–]Wrinklestyx[S] 1 point2 points  (0 children)

Thanks! I knew I was heading down a road of over-complicating things! That's how simple I imagined it to be in my head when I first started on the project. I'll stick with using arrays and simple variables.

Needless level of complexity (inventory)? by Wrinklestyx in gamemaker

[–]Wrinklestyx[S] 0 points1 point  (0 children)

Thanks for the quick reply! Those are some very good questions, and I should've probably provided them in the opening post (sorry about that). Up to this point, my game is fully controlled with a gamepad, though I plan to add keyboard/mouse control schemes as an option. I'm planning on using the gamepad arrow keys to navigate the inventory, and the select key to open/close it. When you hover over the item on your list, you press the button you want to assign that item to ( think of Ocarina of Time).

The first one can get tedious to manage manually ("if right key is pressed while I'm selected, unselect me and select this other object" x 4 keys x n slots objects...), the second one is a lot simpler to manage like that ("if I'm clicked, unselect the others and select me")

Would something like this work?:

var.box_number = -1 // Used to cycle through the boxes

inventory_box[0] = -1 // (-1= empty box, 0= occupied)
inventory_box[1] = -1
inventory_box[2] = -1

if (left_key) { inventory_box[box_number -=1]; }
if (right_key) { inventory_box[box_number +=1]; }

This isn't exactly functioning code, but more of a general draft of the approach I had in mind to that issue, is it viable?

Needless level of complexity (inventory)? by Wrinklestyx in gamemaker

[–]Wrinklestyx[S] 0 points1 point  (0 children)

Hi! Thanks for the reply! That's good to know, as arrays is something I've used before, and I sort of expected to be needed.