Why isn't this creating a random map? - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html) +--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html) +--- Thread: Why isn't this creating a random map? (/thread-7564.html) Pages:
1
2
|
Why isn't this creating a random map? - TheDarkJay - 06-19-2005 Well, why isn't it. I am trying my hand at scrolling, this is just tsting that the map works first Code: SCREENRES 200,200 Why isn't this creating a random map? - whitetiger0990 - 06-19-2005 put RANDOMIZE TIMER near the beginning of the program RND by itself will always return the same sequence whenever the program is run RANDOMIZE TIMER sets the seed to the time something blah blah Why isn't this creating a random map? - Moneo - 06-20-2005 Here's the complete "blah, blah" regarding the RANDOMIZE statement from the QB Online Help. RANDOMIZE [expression] When you use the argument expression, QuickBASIC uses the value to initialize the random-number generator. If the random-number generator is not reseeded, the RND function returns the same sequence of random numbers each time the program is run. To change the sequence of random numbers every time the program is run, place a RANDOMIZE statement at the beginning of the program and change the argument with each run. A convenient way to initialize the random-number generator is to use the TIMER function. Using TIMER ensures a new series of random numbers each time you use the program. ***** Why isn't this creating a random map? - TheDarkJay - 06-20-2005 HOW DID I FORGET RANDOMIZE TIMER? Hang on, i add one to the result, so shoudn't the screen still be just one colour even if rnd returns a value of 0? I've noticed the problem, x is between cameraminx and cameramaxx cameraminx = 400 (larger then the screen size) cameramaxx = 600 (larger than the screen size) FB is trying to plot the co-odinates at areas outside the screen. FB really needs to learn to catch that, maybe a error message that doesn't stop the program from compiling... Why isn't this creating a random map? - MystikShadows - 06-20-2005 NOt necessarily....but it will have the same sequence of "random" colors...in the same order :-) Why isn't this creating a random map? - DrV - 06-20-2005 Quote:HOW DID I FORGET RANDOMIZE TIMER?That can't be a compile-time warning; a run-time warning would be possible, but that would slow things down and bloat gfxlib... just be careful not to use coordinates outside the resolution of the screen. Why isn't this creating a random map? - TheDarkJay - 06-20-2005 I haven't tested it (i'm not at my computer at the moment) but this should work Code: RANDOMIZE TIMER Why isn't this creating a random map? - SotSvart - 06-21-2005 Code: This function plots a single pixel on the screen. The x and y coordinates are Pset dosent do anything if its out of the clipping box, the same goes for put, line etc... Why isn't this creating a random map? - TheDarkJay - 06-21-2005 Quote: I'm aware it clips, it's just anoying when you accidently place something outside the screen and are blissfully unaware. And the code i posted doesn't work, this should, though someone pointing out any errors would be nice... Code: SCREENRES 200,200 Why isn't this creating a random map? - Anonymous - 06-21-2005 fb must clip. end of story :o ill arm wrestle you for it edit: not exactly sure what that last code u posted is supposed to do.... |