Sandbox: Update AddGear
authorWuzzy
Wed, 17 Apr 2019 14:26:17 +0100
changeset 1790 be31df3b4e3d
parent 1789 014d1a4a2133
child 1791 2494d0337156
Sandbox: Update AddGear
Sandbox.wiki
--- a/Sandbox.wiki	Wed Apr 17 14:20:56 2019 +0100
+++ b/Sandbox.wiki	Wed Apr 17 14:26:17 2019 +0100
@@ -13,13 +13,16 @@
 
 === `AddGear(x, y, gearType, state, dx, dy, timer)` ===
 This creates a new gear at position x,y (measured from top left) of kind `gearType` (see [GearTypes Gear Types]).
-The initial velocities are `dx` and `dy`. All arguments are numbers. The function returns the `uid` of the gear created. Gears can have multple states at once: `state` is a bitmask, the flag variables can be found in [States].
+The initial velocities are `dx` and `dy`. All arguments are numbers. The function returns the `uid` of the gear created. Gears can have multple states at once: `state` is a bitmask, the flag variables can be found in [States]. `timer` is the initial timer value of the gear. If a particular gear value does not matter, use `0`.
+
+Position, velocity, state and timer can be changed afterwards with the various setter functions.
 
 Note: If you want to create a hedgehog (`gtHedgehog`), you must call `AddHog` or `AddMissionHog` instead. If you want to spawn a crate (`gtCase`), you must call one of the several “Spawn*Crate” functions (e.g. `SpawnSupplyCrate`) below instead.
 
 Example:
 
-<code language="lua">    local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0)
+<code language="lua">    -- Spawn a target at (0,0) and place it randomly
+    local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) -- also use 0 for velocity. Also 0 for state and timer because they don't matter.
     FindPlace(gear, true, 0, LAND_WIDTH)</code>
 
 === `AddVisualGear(x, y, visualGearType, state, critical [, layer])` ===