LuaAPI.wiki
changeset 692 111f39408390
parent 691 30323b8a8830
child 741 8fa25c5a4967
equal deleted inserted replaced
691:30323b8a8830 692:111f39408390
   939  * `sprBotlevels`
   939  * `sprBotlevels`
   940  * `sprIceTexture`
   940  * `sprIceTexture`
   941  * `sprCustom1`
   941  * `sprCustom1`
   942  * `sprCustom2`
   942  * `sprCustom2`
   943 
   943 
   944 Tint is for an RGBA colouring to apply, this works about the same as Tint in gears.  Behind indicates the sprite should not replace existing land. flipHoriz and flipVert are for flipping the sprite vertically and horizontally before placing.
   944 `tint` is for an RGBA colouring to apply, this works about the same as `Tint` in gears. `behind` indicates the sprite should not replace existing land. `flipHoriz` and `flipVert` are for mirroring the sprite vertically and horizontally before placing, respectively.
   945 The 9th and later arguments specify land flags (see the constants section) to be used for the newly created terrain. If omited, `lfNormal` is assumed.
   945 The 9th and later arguments specify land flags (see the constants section) to be used for the newly created terrain. If omited, `lfNormal` is assumed.
   946 
   946 
   947 Example:
   947 Example:
   948 
   948 
   949 <code language="lua">PlaceSprite(2836, 634, sprAmGirder, 5)
   949 <code language="lua">PlaceSprite(2836, 634, sprAmGirder, 5)
   950 -- Places the girder sprite as normal terrain at (2836, 634). The `frameIdx` 5 is for the long decreasing right girder.</code>
   950 -- Places the girder sprite as normal terrain at (2836, 634). The `frameIdx` 5 is for the long decreasing right girder.</code>
   951 <code language="lua">PlaceSprite(1411, 625, sprAmRubber, 1, nil, nil, nil, nil, lfBouncy)
   951 <code language="lua">PlaceSprite(1411, 625, sprAmRubber, 1, nil, nil, nil, nil, lfBouncy)
   952 -- Places the rubber band sprite as bouncy terrain at (2836, 634). The `frameIdx` 1 is for the decreasing right rubber band.</code>
   952 -- Places the rubber band sprite as bouncy terrain at (2836, 634). The `frameIdx` 1 is for the decreasing right rubber band.</code>
   953 
   953 
   954 ==== <tt>!EraseSprite(x, y, sprite, frameIdx, eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert, [, landFlag, ...])</tt> ====
   954 ==== <tt>!EraseSprite(x, y, sprite, frameIdx, eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert, [, landFlag, ...])</tt> ====
   955 Erases a [Sprites sprite] at the specified position (`x`, `y`) on the map. `frameIdx` is the frame index starting by 0. sprite, frameIdx, flipHoriz and flipVert behave the same as in PlaceSprite.
   955 Erases a [Sprites sprite] at the specified position (`x`, `y`) on the map. `frameIdx` is the frame index starting by 0. `sprite`, `frameIdx`, `flipHoriz` and `flipVert` behave the same as in `PlaceSprite`. For `sprite`, the same subset of sprites is permitted.
   956 
   956 
   957 Set eraseOnLFMatch to true to erase all land for a pixel that matches any of the passed in land flags.  This is useful if, for example, an lfBouncy sprite was placed "behind" land using PlaceSprite and you want to remove it without destroying the non-bouncy terrain.
   957 Set `eraseOnLFMatch` to `true` to erase all land for a pixel that matches any of the passed in land flags.  This is useful if, for example, an `lfBouncy` sprite was placed “behind” land using `PlaceSprite` and you want to remove it without destroying the non-bouncy terrain.
   958 
   958 
   959 Set onlyEraseLF to true to only remove specific land flags.  If for example a sprite consists of lfIndestructible and lfBouncy, and you call EraseSprite with onlyEraseLF and lfIndestructible set, the sprite will remain bouncy but can be destroyed.  You can use this to entirely remove all land flags from a sprite - at this point the sprite will be visual only, painted on the map but with no collision.
   959 Set `onlyEraseLF` to `true` to only remove specific land flags. If for example a sprite consists of `lfIndestructible` and `lfBouncy`, and you call `EraseSprite` with `onlyEraseLF` and `lfIndestructible` set, the sprite will remain bouncy but can be destroyed.  You can use this to entirely remove all land flags from a sprite—at this point the sprite will be visual only, painted on the map but with no collision.
   960 
   960 
   961 Example:
   961 Examples:
   962 
   962 
   963 <code language="lua">EraseSprite(2836, 634, sprAmGirder, 5)
   963 <code language="lua">EraseSprite(2836, 634, sprAmGirder, 5)
   964 -- Removes the girder sprite at (2836, 634). The `frameIdx` 5 is for the long decreasing right girder.</code>
   964 -- Removes the girder sprite at (2836, 634). The frameIdx 5 is for the long decreasing right girder.</code>
   965 <code language="lua">EraseSprite(1411, 625, sprAmRubber, 1, true, true, nil, nil, lfIndestructible)
   965 <code language="lua">EraseSprite(1411, 625, sprAmRubber, 1, true, true, nil, nil, lfIndestructible)
   966 -- Removes indestructibility from a rubber band sprite at (2836, 634). The `frameIdx` 1 is for the decreasing right rubber band.</code>
   966 -- Removes indestructibility from a rubber band sprite at (2836, 634). The frameIdx 1 is for the decreasing right rubber band.</code>
   967 
   967 
   968 ==== <tt>!AddPoint(x, y [, width [, erase] ])</tt> (0.9.21) ====
   968 ==== <tt>!AddPoint(x, y [, width [, erase] ])</tt> (0.9.21) ====
   969 This function is used to draw your own maps using Lua. The maps drawn with this are of type “hand-drawn”.
   969 This function is used to draw your own maps using Lua. The maps drawn with this are of type “hand-drawn”.
   970 
   970 
   971 The function takes a `x`,`y` location, a `width` (means start of a new line) and `erase` (if `false`, this function will draw normally, if `true`, this function will erase drawn stuff).
   971 The function takes a `x`,`y` location, a `width` (means start of a new line) and `erase` (if `false`, this function will draw normally, if `true`, this function will erase drawn stuff).