Define two imaginary parallel lines along the horizon separated by 100
units. The bottom line is the base of the mountains. Assuming that
the horizontal length of the lines is 500 units, start a loop (for
x=1 to 500) to generate the coordinates of the landscape. Your first
coordinate
will be x, y where y will be your previous y coordinate (originally
the y coordinate of your bottom line) plus a random number between -10
and +10. Any y values outside the range of the imaginary lines are
made equal to the previous y value. Draw a line between the previous
x,y coordinate and the new one. The result will be a random walk
between the two imaginary lines that will represent the mountain
landscape. By adjusting the number of units separating the imaginary
lines, the horizontal length, and the step of the random walk, you can
get different terrains.
xyz
On 19 Nov 2003 09:22:55 -0800,
er*****@bellsouth.net (Eric) wrote:
I'm a new programmer on Visual Basic and for any of you who play tank
wars, I'm attempting to lay out a terrain similar to it. What I need
is a terrain that I can draw (Basically just a random line across the
screen). I have no idea how to do this though.
http://www-user.tu-chemnitz.de/~mali...ages/spiel.gif
Taht is a link to an idea of how it is to look. I have made the tanks
with the ability to rotate the barrells, shoot, and such. I'm not
looking to make explosions in the terrain or for the terrain to move
in any way after generating it. If you can use that link, the view is
from the side, so this is only 2D. The last thing I need to do is be
able to know where the terrain was generated so I can place a tank on
the actually terrain after having it created. Thanks to Anyone who
can help!