I have an array that places food into a game. There is a tile in 8 different spots, and I have an array place four different food sprites at random on those tiles. When I load my game food is placed on those 8 tiles, and each time it seems to be placing one of four different food sprites at random (which is what I want). The problem is that when I restart my game it is placing extra food sprites in the middle of the screen.
Here is where I want the food sprites to go (the food sprite tile says “F1”):
Here is the code and the array that places one of four different food sprites:
Here is what happens when I load my game (the extra food sprites are all stacked up in the middle of the screen):
Does anyone know why the extra sprites are showing up in the middle of the screen?
If so, do you know how I could stop this from happening?