SuperSonic wrote:@AcisAce: It is actually better to use multiple files than to put your whole game in one big exe. But to fix the problem you stated, you can simply export your game as a dat file instead of exe and still use loadgame()
This is arguable. The reason I find using a single file is better is you don't have to recode it in every file. If gE allowed for importing actors, this would no longer be an issue. Also using a single file allows for quick moving between levels and menus, and you don't need to worry about saving variables over the jumps.
SuperSonic wrote:@Hblade: This is a little off topic but I never fully understood the max() function. Could you explain it please?
All max does is return the larger of the two numbers passed. So max(2, 5) would return a 5. min does the opposite. You can use these functions to limit variables one way or another.
- Code: Select all
x = min(100, x+1); // increases x, but sets 100 as the max x value
// it does this because it returns the smaller number between the two
// if x+1 is smaller, it returns x+1 (meaning x was increased)
// but if x+1 is bigger, it returns 100
Again, min works the same way, but opposite. Now you can use both min and max in tandem to limit a variable in both directions.
- Code: Select all
x = max(0, min(100, x));
// this limits x between 0 and 100
// min(100, x) returns the smaller of the two, meaning the value returned is no greater than 100
// then max(0, <value that is no greater than 100>) returns the larger of the two, meaning the return value must be greater than 0
Usually when using the min function, you are setting a max limit (no greater than), while when you use the max function you are setting a minimum limit (no less than). At first it may seem a bit backwards but it makes sense given the functions.