can somebody explain me in plain laguage, how to make random lines crossing from top to botton of screen? it's for simulating thunders attacking a city in a game
random
Collapse
X
-
I'm sorry, the language is C.
What I'm trying to do is that game "defender". The thunders come down from the top of the screen as straight lines, and I'm supposed to prevent them from reaching the city with a little bar.
Should look something like this...
............... ............... ..............|
............... ............... ..............|
............... ............... ..............|
............... ............... .............\|/
............... ............... ............___
CITY CITY CITY CITY CITY CITY CITY CITY CITY CITY CITY CITY CITY CITY CI
so the thunder should be random and the speed has to increase, but what I need to know right now is how to make the thunder appear and then make it random and automatic.Comment
-
Your example suggests that these lines are always vertical. If so, then you only need one random number corresponding to the x coordinate of the vertical line. If the lines can be slanted then as boxfish said in post #3, you need two random numbers, the x coordinates of the top and bottom points of the line.Comment
Comment