Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.51 KB | None | 0 0
  1. #include "zcommon.acs"
  2. //-----------------------------------------------------------------------------------------
  3.  
  4. Script 2 (void)
  5. {
  6.    if(Thingcount(T_ROCKETLAUNCHER, 22)==0)
  7.    Thing_Spawn(21, T_ROCKETLAUNCHER, 0, 22);
  8.    delay(5);
  9.    if(Thingcount(T_ROCKETAMMO, 23)==0)
  10.    ACS_Execute(3, 0, 22, 0, 0);
  11. }
  12.  
  13. Script 3 (int tag)
  14. {
  15.     int basex = GetActorX (tag);
  16.     int basey = GetActorY (tag);
  17.     int basez = GetActorZ (tag);
  18.     int angle;
  19.     int cos_rockets = random (25, 35); // For Cosinusoid
  20.     int cos_amplitide = random (16, 48);; //For Cosinusoid
  21. //----------------------------------* Cosinusoid *----------------------------------
  22.     for (int si = 0; si < cos_rockets; si++)
  23.     {
  24.          angle = 1.0 * si / 12;
  25.          Spawn("RocketAmmo", basex + 5.0*si - 66.0,
  26.                              basey + cos_amplitide*cos(angle) - 10.0,
  27.                              basez, 23);  
  28.      delay(5);
  29.      }
  30. }
  31.     /*
  32.       Cosinusoid on the OX axis:
  33.         Y^  
  34.          |
  35.          |~                      ~~                      ~~
  36.          | \                    /  \                    /  \
  37.          |  \                  /    \                  /
  38.          |   \                /      \                /
  39.          |    \              /        \              /
  40.     ____O|_____\___________ /__________\____________/______> X
  41.          |      \          /            \          /
  42.          |       \        /              \        /
  43.          |        \      /                \      /
  44.          |         \    /                  \    /
  45.          |          \  /                    \  /
  46.          |           ~~                      ~~
  47.        
  48.         Function: f(x)= D + A*cos(angle); D - Distance from axis start point (0,0)
  49.                                           A - Amplitude of the swing
  50.                                           angle - Method of how angle is changing
  51.        
  52.         Cosinusoid graph shows the swing of Y coordinates while X coordinate is increasing.
  53.         It is possible to get various shapes of the cosinusoid graph. It depends on some arguments:
  54.         Amplitude - the higher the value the taller waves of the cosinusoid. Also bigger graph.
  55.        
  56.         OX drift  - is described under X coordinates as a linear function (f(x)=k*x). The bigger
  57.                     coefficient k the higher speed of the OX drift. As a result we can see that items
  58.                     in the coisinusoid are placed much further from each other.
  59.                    
  60.         Angle     - 1.0*I/J Shows a method how angle is changing. In the cosinusoid it sets how
  61.                     quickly the deployment of items is changing. This is the main argument that makes
  62.                     your cosinusoid look respectable. The higher the value the bigger swing frequency
  63.                     and the closer waves of the cosinusoid to each other. So to make your cosinusoid
  64.                     more clear try to keep bigger J value comparing it to I. It is very important to
  65.                     multiply this ratio by 1.0 - full fluctuation (swing) cycle. We use dot because
  66.                     it's a fixed point value and not an integer. We need a fixed point value because
  67.                     the result of the ratio (I/J) is also fixed point. When I becomes equal to J (I=J)
  68.                     cosinusoid does 1 full period (from top to top).
  69.        
  70.         For example I'm placing rocket ammos near a rocket launcher 66.0 pixels to the left from the
  71.         launchers' X coordinate.  
  72.     */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement