I generate a world using an array that stores all the Tile IDs. The Tiles change their animation based on where they are relative to the array. But what I want to do is make it so I can change frames based on the surrounding tiles. I've tried all sorts of things but it doesn't seem to work at all! Here's what I have currently:

For some reason it just sets them all to frame 1, even though the animation speed is set to 0.
I can't seem to figure out why it does this, so I was wondering if any of you knew what was wrong?
Thanks!!