E2150 - Weather: Difference between revisions

no edit summary
No edit summary
Line 41:
===== Finding the random "initial location" =====
The game calculates a random distance (''r1'', within 0-''range'') and a random angle ''alpha'' (0-255, where 256 == 2*PI rad). With the use of ''sin'' and ''cos'' functions of ''alpha'', multiplied by the ''r1'' value, the game calculates offset (''x1'', ''y1'') from the epicenter. After applying the offset to the ''x'' and ''y'' parameters, we will get a point (''x2'', ''y2''). This point is the initial hit location. If the location is outside of the level, the lightning won't spawn. There is no difference for the lightning to spawn in the accessible or the inaccessible area of the map (the level "margin"), so casting rainstorm near the edge of the level will result with fewer lightnings spawned and/or fewer lightnings hitting relevant area. You may also notice that '''lightnings are more likely to hit nearby the epicenter''', rather than on the further distances.
[[File:HitProbability.png]]
 
===== Altering hit location by nearby high elements =====