LuaAPI.wiki
changeset 1703 c7d3e5459a58
parent 1702 e9a2b9e33060
child 1704 09694f0d4e90
equal deleted inserted replaced
1702:e9a2b9e33060 1703:c7d3e5459a58
   690  * `Boom`: Used by most gears to determine the damage dealt.
   690  * `Boom`: Used by most gears to determine the damage dealt.
   691 
   691 
   692 Example:
   692 Example:
   693 <code language="lua">
   693 <code language="lua">
   694 -- Get all values in a single line of code:
   694 -- Get all values in a single line of code:
   695 local Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, nImpactSounds, Tint, Damage, Boom = GetGearValues(myGear)
   695 local Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, nImpactSounds, Tint, Damage, Boom, Scale = GetGearValues(myGear)
   696 </code>
   696 </code>
   697 
   697 
   698 === <tt>!GetVisualGearValues(vgUid)</tt> ===
   698 === <tt>!GetVisualGearValues(vgUid)</tt> ===
   699 This returns the typically set visual gear values for the specified visual gear `vgUid`, useful if manipulating things like smoke, bubbles or circles. On success, it returns the following values:
   699 This returns the typically set visual gear values for the specified visual gear `vgUid`, useful if manipulating things like smoke, bubbles or circles. On success, it returns the following values:
   700 
   700 
   701 `X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint`
   701 `X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint, Scale`
   702 
   702 
   703  * `X`, `Y`: typically position
   703 The meaning of these values is the same as in `SetVisualGearValues`.
   704  * `dX`, `dY`: typically speed
       
   705  * `Angle` is usually the rotation angle
       
   706  * `Frame` is typically the animation frame
       
   707  * `FrameTicks` is usually an animation counter
       
   708  * `State` can have a variety of values, but is typically bit packed
       
   709  * `Timer` is usually the gear lifetime
       
   710  * `Tint` is the RGBA color
       
   711 
   704 
   712 If the visual gear does not exist, `nil` is returned. Always check the result for `nil` before you plug in the values anywhere.
   705 If the visual gear does not exist, `nil` is returned. Always check the result for `nil` before you plug in the values anywhere.
   713 
   706 
   714 Most visual gears require little to no modification of parameters.
   707 Most visual gears require little to no modification of parameters.
   715 
   708 
   716 Example:
   709 Example:
   717 
   710 
   718 <code language="lua">-- Return visual gear values
   711 <code language="lua">-- Return visual gear values
   719 local X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint = GetVisualGearValues(vgUid)
   712 local X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint, Scale = GetVisualGearValues(vgUid)
   720 </code>
   713 </code>
   721 
   714 
   722 == Functions to modify gears ==
   715 == Functions to modify gears ==
   723 
   716 
   724 === <tt>!HideHog(gearUid)</tt> ===
   717 === <tt>!HideHog(gearUid)</tt> ===
   771          SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF)
   764          SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF)
   772     end
   765     end
   773 end
   766 end
   774 </code>
   767 </code>
   775 
   768 
   776 === <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint)</tt> ===
   769 === <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint, Scale)</tt> ===
   777 This allows manipulation of the internal state of the visual gear `vgUid`. If `vgUid` is invalid or the `vgUid` does not refer to an existing visual gear, the function does nothing. Thus, you can safely call this function even if you are not sure if the visual gear actually exists.
   770 This allows manipulation of the internal state of the visual gear `vgUid`. If `vgUid` is invalid or the `vgUid` does not refer to an existing visual gear, the function does nothing. Thus, you can safely call this function even if you are not sure if the visual gear actually exists.
   778 
   771 
   779 All visual gear values are numbers. Each visual gear may be using these parameters differently, but the *usual* meaning of these is the following:
   772 All visual gear values are numbers. Each visual gear may be using these parameters differently, but the *usual* meaning of these is the following:
   780 
   773 
   781  * `X`, `Y`: Position
   774  * `X`, `Y`: Position
   782  * `dX`, `dY`: Speed along the X and Y axis
   775  * `dX`, `dY`: Speed along the X and Y axis
   783  * `Angle`: Current rotation
   776  * `Angle`: Current rotation
   784  * `Frame`: Image frame, if using a sprite sheet
   777  * `Frame`: Image frame, if using a sprite sheet
   785  * `FrameTicks`: ???
   778  * `FrameTicks` is usually an animation counter
   786  * `State`: Helper value to save some internal state
   779  * `State`: Helper value to save some internal state
   787  * `Timer`: Time in milliseconds until it expires
   780  * `Timer`: Time in milliseconds until it expires
   788  * `Tint`: RGBA color
   781  * `Tint`: RGBA color
       
   782  * `Scale` is a scale factor (not used by all visual gears)
   789 
   783 
   790 Some visual gears interpret these values differently, just like normal gears. See [VisualGearTypes] for details.  Also, most visual gears are not using all possible values, while some values are just ignored.
   784 Some visual gears interpret these values differently, just like normal gears. See [VisualGearTypes] for details.  Also, most visual gears are not using all possible values, while some values are just ignored.
   791 
   785 
   792 Note that most visual gears require little to no modification of their values.
   786 Note that most visual gears require little to no modification of their values.
   793 
   787