LuaAPI.wiki
changeset 1188 fbcd3b2458b8
parent 1165 7438c7dfeff6
child 1189 e69155e475c8
equal deleted inserted replaced
1187:70628fea6065 1188:fbcd3b2458b8
   677     end
   677     end
   678 end
   678 end
   679 </code>
   679 </code>
   680 
   680 
   681 === <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint)</tt> ===
   681 === <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint)</tt> ===
   682 This allows manipulation of many of the visual gear values. In the case of `vgtCircle`, the visual gear values are mapped as follows:
   682 This allows manipulation of many of the visual gear values of the visual gear `vgUid`. All visual gear values are numbers. Each visual gear may be using these parameters differently, but the *usual* meaning of these is the following:
   683 
   683 
   684  * `X`, `Y`: Position
   684  * `X`, `Y`: Position
   685  * `State`: Radius.
   685  * `dX`, `dY`: Speed along the X and Y axis
   686  * `Timer`: Thickness
   686  * `Angle`: Current rotation
   687  * `FrameTicks`: Pulsation speed (`0` to disable)
   687  * `Frame`: Image frame, if using a sprite sheet
   688  * `dX`, `dY`: min/max pulsation opacity (`0`-`255`)
   688  * `FrameTicks`: ???
       
   689  * `State`: Helper value to save some internal state
       
   690  * `Timer`: Time in milliseconds until it expires
   689  * `Tint`: RGBA color
   691  * `Tint`: RGBA color
   690 
   692 
   691 Most visual gears require little to no modification of parameters.
   693 Some visual gears interpret these values differently, just like normal gears. See [VisualGearTypes] for details.  Also, most visual gears are not even using some of these values.
       
   694 
       
   695 Note that most visual gears require little to no modification of their values.
   692 
   696 
   693 Example 1:
   697 Example 1:
   694 
   698 
   695 <code language="lua">  -- set a circle to position 1000,1000 pulsing from opacity 20 to 200 (8%-78%), radius of 50, 3px thickness, bright red.
   699 <code language="lua">  -- set a circle to position 1000,1000 pulsing from opacity 20 to 200 (8%-78%), radius of 50, 3px thickness, bright red.
   696     SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff)</code>
   700     SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff)</code>
   697 
   701 
   698 Beginning from 0.9.21-dev, the 2nd to 11th arguments are optional. Any such argument which is declared as `nil` will not overwrite the corresponding value of the visual gear. With this change, it is not required anymore to call `GetVisualGearValues` beforehand.
   702 Only the first argument is required. Everything else is optional. Any such argument which is declared as `nil` will not overwrite the corresponding value of the visual gear.
   699 
   703 
   700 Example 2:
   704 Example 2:
   701 
   705 
   702 <code language="lua">  -- set a circle to position 1000,1000
   706 <code language="lua">  -- set a visual gear to position 1000,1000
   703     SetVisualGearValues(circleUid, 1000, 1000)</code>
   707     SetVisualGearValues(circleUid, 1000, 1000)</code>
   704 <code language="lua">  -- set the color of a circle to bright red.
   708 <code language="lua">  -- set the tint of a visual gear to bright red.
   705     SetVisualGearValues(circleUid, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xff0000ff)</code>
   709     SetVisualGearValues(circleUid, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xff0000ff)</code>
   706 
   710 
   707 
   711 
   708 === <tt>!FindPlace(gearUid, fall, left, right, tryHarder) (0.9.16)</tt> ===
   712 === <tt>!FindPlace(gearUid, fall, left, right, tryHarder) (0.9.16)</tt> ===
   709 Finds a place for the specified gear between x=`left` and x=`right` and places it there. 0.9.16 adds an optional fifth parameter, `tryHarder`. Setting to `true`/`false` will determine whether the engine attempts to make additional passes, even attempting to place gears on top of each other.
   713 Finds a place for the specified gear between x=`left` and x=`right` and places it there. 0.9.16 adds an optional fifth parameter, `tryHarder`. Setting to `true`/`false` will determine whether the engine attempts to make additional passes, even attempting to place gears on top of each other.