SDL - object not drawing itself
// get_random_x returns a random value between 25 and 590.int get_random_x(){ return((rand()%590) + 25);}// get_random_y returns a random value between 25 and 430.int get_random_y(){ return((rand()%430) + 25);}
The way you have this code as of now, you would get a random number from 25-614 and 25-454. A way to fix this would be to do
// get_random_x returns a random value between 25 and 590.int get_random_x(){ return((rand()%566) + 25); // returns # from 25-590}// get_random_y returns a random value between 25 and 430.int get_random_y(){ return((rand()%406) + 25); // returns # from 25-430}
Of course, there is probably a better way but this seemed pretty simple to me.
[Edited by - Deuce81 on August 21, 2007 7:32:54 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement