Hello,
I would like to make a puzzle game. Therefore I've set up a grid of 81 sprite instances (aligned as 9x9 instances on the layout).
All instances have the same starting animation frame.
When I select one instance in the grid by clicking on it, let's say Sprite instance 10, which is the second sprite on the second row (because it's 0-based), it should 'trigger' all instances directly surrounding the selected instance. In this example, instances 1, 9, 11 and 19 (the ones above, on the left, on the right and below) should advance 1 animation frame. All other instances should remain intact.
Preferrably I would like to use a simple function that performs this check for each instance in the grid, by 'picking' the instances that are positioned above, below, left and right of the selected instance.
I'm wrecking my brains on this, but I can't figure out how to do this best, and how to implement the correct conditions and actions to archieve this behaviour.
What are the conditions and actions to pick the surrounding instances, in order to change their animation frame?
Thanks in advance!