Snake Update 5
The next logical step for me was to add a collectable class. This would need to have a random function so that it didn’t spawn in the same place each time but would also need to have a limit on where it could spawn. For ease of use, I decided that I would make the collectable spawn on one of the locations that the snake head could enter so that it would make collision easier, or should I say pseudo-collision.
Thinking back on last year, I remembered an easy function for creating random numbers and that was the rand() function which comes from c++. In order to get it to spawn in at uniform intervals, I would get the random function to create an integer in the range 1-9 then multiply that number by the scale of my play grid (in my case it was 100).