Section (class)
Revision as of 04:59, 7 February 2018 by Yingchun Soul (talk | contribs)
This class provides fields/functions for managing Sections in the current level.
Static functions
| Static Section Functions (level only) | ||
|---|---|---|
| Function | Return values | Description |
| Section.get() | table of Section | Returns the array of Sections. The first element of the array represents the first section. (LunaLua ≥ v0.7.2) |
| Section.get(number sectionID) | Section | Gets the section object by the section id. Valid number are from 1 (first section) to 21 (last section) (LunaLua ≥ v0.7.2) |
| Section | Returns the Section object by the section id. Valid numbers are from 0 (first section) to 20 (last section) | |
Instance functions
These fields and functions are part of Section Objects and have to be called for that object. Trying to call them from the static Section class will result in an error. Example (feel free to copy it into your lua file to see how it works):
function onStart()
for index,mySection in ipairs(Section.get()) do
mySection.backgroundID = index
end
end
| Section class | |||
|---|---|---|---|
| Type | Function/Field | Return values/Value type | Description |
| Field | Section.boundary | RECTd | The section boundary. |
| Field | Section.musicID | number | The musicID of the section. (LunaLua ≥ v0.7.2) |
| Field | Section.isLevelWarp | boolean | If the section is a warp level. (LunaLua ≥ v0.7.2) |
| Field | Section.hasOffscreenExit | boolean | If the section can be left by going out of bounds of the level. (LunaLua ≥ v0.7.2) |
| Field | Section.backgroundID | number | The background ID of the section. (LunaLua ≥ v0.7.2) |
| Field | Section.noTurnBack | boolean | If the player cannot go back in the left direction. (LunaLua ≥ v0.7.2) |
| Field | Section.isUnderwater | boolean | If the section is a underwanter section. (LunaLua ≥ v0.7.2) |