Originally Posted by
pikaguy900
DarkDragon, I DID check the documentation, but it doesn't tell how to use a single variable there. Basically, it's just saying "Here's the variables, go figure out how to use them yourselves", which I don't like. I'm STILL not sure if I'm using it right....
blue_knight, thank you for helping me out with that variable. I never would've thought to use "Screen->". XD
Edit: But that brings me to another question. When using Rand, how would I make it so there's a specifc MINIMUM value, too? I need a random number so I can load a random enemy to modify, but.... If the Random number ever comes back 0, nothing will happen. How would I make it so it can never come back 0, only numbers 1-10?
The documentation is split up by which variable you need to use. Global functions are not associated with any pointer type, so you just plain call them:
Code:
int randnumber = 5 + Rand(5); //makes a random number from 5 to 9
any function or variable under the "X Functions and Variables" headings require a pointer of type X. For instance, to use the X that is Link's position, you would do
Code:
Link->X = 0; //move link to the right of the screen
Is that what you were asking about? Or are you talking about actual, user defined variables?
For your second question, notice that Rand(y) will give you a number such that 0 <= x < y. But you want 1 <= x < 11, right? So we can do some algebra to calculate what you need to do. To get the correct lower value, we can add 1 to the result (1 + Rand(y)) to get 1 <= x < y+1. Then clearly you want y=10, so
Code:
int whatever = 1 + Rand(10);
would get you a number from 1 to 10, inclusive.