Hi, guys! I am a Chinese user.
Here I am making a snake game which has a free mode.
When the snake eats the food. it will create a new food in the cells.
I am facing with a question that is how to place the food(the apple) in 20x20 cells randomly.
Now i am using the random function to generate. but sometime the food is out of the frame.
[*]X of the food = (Random((640/20)-1)+1)*20-10[*]Y of the food = (Random((480/20)-1)+1)*20-10
Thanks anyway! If anyone can show me an example. I will appreciate.