Need Help!!!!!!
I really need some help for a school project I''m doing that is due Thursday. How do you randomly select a texture? I''ve tried the obvious use of a variable (let''s call it a) that is made from a rand statement. I tried placing the variable in place of the number used to specify what texture that you want, but Dev-C++ tells me "invalid types `unsigned int[6][GLfloat]'' for array subscript". How do I select a random texture?
I think you''re on the right track. Create a variable like you said but make it an integer. Then do this:
Now if memory serves me correctly that should pick a random integer between 0 and NUM_TEXTURES. It''s been a while since I used rand() so I may be wrong.
Oh and dont forget to randomise the numbers by using srand().
Just one question though. Why do you have a 2 dimensional array?
Hope that helps.
"To err is human, to really mess up requires a computer"
#define NUM_TEXTURES 3 (Or however many you have)int variable = 0;variable = rand()%NUM_TEXTURES
Now if memory serves me correctly that should pick a random integer between 0 and NUM_TEXTURES. It''s been a while since I used rand() so I may be wrong.
Oh and dont forget to randomise the numbers by using srand().
Just one question though. Why do you have a 2 dimensional array?
Hope that helps.
"To err is human, to really mess up requires a computer"
"To err is human, to really mess up requires a computer"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement