List of LuaSTG Constant Variables and Values

From LuaSTG Wiki
Jump to navigation Jump to search

Here is a look up table for some constants defined by the engine.


Coordinates and Screen[edit | edit source]

Borderimage.png

Here are some values related to the in-game coordinates. The origin of in-game coordinates is (0, 0), which locates at the center of the play field. The convention is that x-axis points rightward and the y-axis points upward.

We use (x, y) to refer to a point. Rectangles are represented by two intervals on x-axis and y-axis, in the form (xmin, xmax, ymin, ymax).

Name Values
Player Spawn Position a point (0, -176)
Player Movement Border a rectangular area (-184, 184, -208, 192)
Screen Border a rectangular area (-192, 192, -224, 224)
Out of Bound Deletion a rectangular area (-224, 224, -256, 256)

Player Movement Border is a rectangular border that limits the movement of the player.

Screen Border is a rectangular border separating the HUD and the gameplay field.

Out of Bound Deletion is a rectangular area. In every frame, the game will check and delete all bullets (1) with bound attribute set to true, (2) that are outside the out of bound deletion border at the same time.

Alternatively, the boundaries of screen border can be obtained by reading lstg.world.l/r/b/t, l/r/b/t are abbreviations for left/right/bottom/top; the out of bound deletion boundaries can be read from lstg.world.boundl/boundr/boundb/boundt.

Player Movement Speed[edit | edit source]

This is a table that lists the movement speed for different player shot types.

Shot Type Low Speed (by holding shift) High Speed
Reimu 2 4.5
Marisa 2 5

Object Groups[edit | edit source]

Objects in an object group can be iterated with For Each Unit in Group. Below are two tables about object groups.


Built-in Object Groups[edit | edit source]

There are 16 object groups in LuaSTG (numbered from 0 to 15). Only a number of them are defined by default, and they are listed below.

Newer versions of LuaSTG use some of the higher numbered ones, but they are not included in the table.

Group Name Value Description
GROUP_GHOST 0 A group that does not have any pre-defined collisions and interactions with other groups
GROUP_ENEMY_BULLET 1 Destructible enemy bullets
GROUP_ENEMY 2 Enemies
GROUP_PLAYER_BULLET 3 Bullets shot by the player
GROUP_PLAYER 4 Player
GROUP_INDES 5 Indestructible enemy bullets and objects. "INDES" stands for indestructible
GROUP_ITEM 6 Items


Collision Groups[edit | edit source]

Object groups are used in implementation of collision detection in LuaSTG.

The on colli method of an object under group A is called upon colliding with objects under group B, given that CollisionCheck(A, B) is performed at that particular frame (the order of A and B matters).

Here is a list of CollisionCheck calls the engine will perform in each frame:

Group Self Group Other
GROUP_PLAYER GROUP_ENEMY_BULLET
GROUP_PLAYER GROUP_ENEMY
GROUP_PLAYER GROUP_INDES
GROUP_ENEMY GROUP_PLAYER_BULLET
GROUP_ITEM GROUP_PLAYER

Newer versions of LuaSTG may have additional collision checks.

Layers[edit | edit source]

Every object has a numerical attribute called layer. This attribute decides the order in which the object is rendered on the screen relative to other objects. Higher values of layer will be rendered on the top.

Here is a list of pre-defined layer values.

Movement Mode Value Description
LAYER_BG -700 layer of the background
LAYER_ENEMY -600 layer of the enemy
LAYER_PLAYER_BULLET -500 layer of player bullets
LAYER_PLAYER -400 layer of the player sprite
LAYER_ITEM -300 layer of items
LAYER_ENEMY_BULLET -200 layer of enemy bullets
LAYER_ENEMY_BULLET_EF -100 layer of the special effects of enemy bullets
LAYER_TOP 0 a value above all other pre-defined layers

Movement Modes[edit | edit source]

There are 4 built-in movement modes in LuaSTG. They are:

Movement Mode Description
MOVE_NORMAL Move in constant speed to target position
MOVE_ACCEL Move in accelerating speed starts with zero initial speed to target position
MOVE_DECEL Move in decelerating speed ends with zero final speed to target position
MOVE_ACC_DEC Move in accelerating speed in the first half and decelerating speed in the second half

Similar to LuaSTG bullet colors, those movement modes are implemented with number constants.

Extra Tables[edit | edit source]

Some tables either come from existing wiki pages or are too long to be kept in the same page. Below provides some links for them.

See List of LuaSTG Bullet Colors and Types for a list of bullet styles and colors.

See Blend Mode or Render Mode (-x) for built-in blending options available in rendering object sprites.