394 This function is called after the stats for the stats screen (after the game) have been generated. You are supposed to call `DeclareAchievement` here. |
394 This function is called after the stats for the stats screen (after the game) have been generated. You are supposed to call `DeclareAchievement` here. |
395 |
395 |
396 == Functions for creating gears == |
396 == Functions for creating gears == |
397 |
397 |
398 === <tt>!AddGear(x, y, gearType, state, dx, dy, timer)</tt> === |
398 === <tt>!AddGear(x, y, gearType, state, dx, dy, timer)</tt> === |
399 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]. |
399 This creates a new gear at position x,y (measured from top left) of kind `gearType` (see [GearTypes Gear Types]). Gears are dynamic objects or events in the world that affect the gameplay, including hedgehogs, projectiles, weapons, land objects, active utilities and a few more esoteric things. |
|
400 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]. |
400 |
401 |
401 Example: |
402 Example: |
402 |
403 |
403 <code language="lua"> local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) |
404 <code language="lua"> local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) |
404 FindPlace(gear, true, 0, LAND_WIDTH)</code> |
405 FindPlace(gear, true, 0, LAND_WIDTH)</code> |
405 |
406 |
406 === <tt>!AddVisualGear(x, y, visualGearType, state, critical [, layer])</tt> === |
407 === <tt>!AddVisualGear(x, y, visualGearType, state, critical [, layer])</tt> === |
407 This attempts to create a new visual gear at position x,y (measured from top left) of kind `visualGearType` (see [VisualGearTypes Visual Gear Types]). Visual gears are decorational objects which are usually used for purely decorational graphical effects. They have no effect on gameplay. |
408 This attempts to create a new visual gear at position x,y (measured from top left) of kind `visualGearType` (see [VisualGearTypes Visual Gear Types]). Visual gears are decorational objects which are usually used for purely decorational graphical effects. They have no effect on gameplay. Visual gears are not the same as gears, but they share some similarities. |
408 |
409 |
409 The function returns the `uid` of the visual gear created or `nil` if creation failed. There is no guarantee that a visual gear will spawn. *IMPORTANT: Do not rely on visual gears to spawn*. *Always* be prepared for this function to return `nil`. |
410 The function returns the `uid` of the visual gear created or `nil` if creation failed. There is no guarantee that a visual gear will spawn. *IMPORTANT: Do not rely on visual gears to spawn*. *Always* be prepared for this function to return `nil`. |
410 |
411 |
411 Set `critical` to `true` if the visual gear is crucial to gameplay and must always be spawned when in-game. Use `false` if it is just an effect or eye-candy, and its creation can be skipped when in fast-forward mode (such as when joining a room). |
412 Set `critical` to `true` if the visual gear is crucial to gameplay and must always be spawned when in-game. Use `false` if it is just an effect or eye-candy, and its creation can be skipped when in fast-forward mode (such as when joining a room). |
412 |
413 |