I have a family called "ItemSlot" with a variable called "ItemSlotNumber". I have placed 6 ItemSlots in my layout, each having a unique number in the ItemSlotNumber variable.
(1,2,3,4,5,6)
I also have a global variable called SelectedItemSlot and a sprite called SelectSprite
If ItemSlot.ItemSlotNumber=SelectedItemSlot
Every tick, set SelectSprite X to ItemSlot.ImagePointX(0)
On Left Arrow Key Pressed, subract 1 to SelectedItemSlot
On Right Arrow Key Pressed, add 1 to SelectedItemSlot
However. If an ItemSlot is empty, I want the next non empty slot to be selected if pressing left or right. It must be able to skip several slots if required. Is there a smart way to do this without having to brute force every possible scenario through events? Note that I do not want to implement an array this late in the game's development.