-
Alligning to grid?
I am making this little demo that has a grid (directx application) of lines 32x32. There is this box, 32x32, which has to move randomly in the grid, alligned to it. What I do is performing a rand()%viewport.Width and Height for the x,y of the box (x,y is the position of the top-left corner of the box). The problem is, that I cant make rand() work only for randomizing values multipliers of 2, which is 32 i want. ANy ideas?
I hope you understand the question well,
Thanks!
-
Hmm, I didn't really understand, but this is the way to create a random number that is a multiplier of 2:
Code:
int num = 2*(rand()%16);
-
Thats is exactly what i wanted, thanks a lot!!