How to select the last column of numbers in this snake game?

46 views Asked by At

I am creating a snake game and need to target the last column of numbers so i can make logic to make the snake 'teleport' to the opposite side when it enters it. I can do that however im finding it tricky to target the last column of numbers. I need something like if snake[0] is equal to the numbers 19 to 399, the below code runs. Any clever math equations? ;)

enter image description here. The picture should help.

else if (direction === 'up' && snake[0] === ??? {
      
      
      newFrame()
}
0

There are 0 answers