Skip to main content

I have a grid of images as shown below. I plan to apply to variables to each image - an “x” variable, and a “y” variable - with the values being their x,y position in the grid.

I also have 2 buttons, “Horizontal” and “Vertical”, with values that can increment. 

My goal is; when the value of the “Horizontal” button is 1 AND the value of the “Vertical” button is 1, then only the bottom-left image is displayed, everything else is hidden.

The logic for each of the images would be something like;
if Horizontal = x and vertical = y, then “Hidden” = false; otherwise, “Hidden” = true

My problem is that when I apply x and y variables to each of my images, they all have the same value, when what I would have wanted is for each image to have the same x and y variables but different values. For example: the bottom-left image will have x=1 and y=1, the image above that will have x=1 and y=2, and the image beside it will have x=2 and y=1, and so on.

Is this possible?
 

Grid of images

 

Horizontal and Vertical values that can be incremented

 

Be the first to reply!