Looping Level Sections
"Level Boundaries" not only set the beginning and ending/upper and lower extents that a
Player and his screen can progress in a level, but they can also be used to set the
beginning and end/top and bottom of a looping section of the level.
Any section of a level can be made to loop on the X and/or Y axis. When looping is
active, the beginning of the given level section will be repeated at the end, and the
end will be repeated at the beginning. Players and Objects will "wrap around" once
they cross either border- if they cross the end, their position will be adjusted so
that they are moved to the beginning, and if they cross the beginning, their position
will be adjusted so that they are moved to the end. The area will appear to repeat
forever until looping is disabled and new boundaries are set.
Although Level/Loop Boundaries can be set at any point in the level (pixel by pixel),
it's recommended that they be set at the beginning of the first tile, and the
beginning of the tile that comes directly after the last one (the boundary positions
should be divisible by 8).
Other important notes:
Level looping is controlled by the following "Game Variables":
- Never place objects within "Activity Range" of any side of a looping area.
This subjects them to the wrap-around effect of the looping area, meaning that when level looping is activated, Objects
in this area will mistakenly have their positions adjusted as if they "wrapped around" the looping area.
- Dynamic level section looping (looping level sections that are set and unset during
gameplay) will not function properly in 2-player split-screen mode. There is no way
to apply proper looping control to Objects when both players have different Level
Boundary settings while looping is active. If both players have the same settings,
however (such as with a level that always loops from top to bottom), it will work
properly in 2-player mode.
- Built-in and Scripted Player/Object and Projectile/Object collision tests that are performed during the "Collision Phase"
automatically account for looping level sections, but if any scripted collision tests are performed at any other time, such
as during an Object's "Movement Phase", Objects on the other side of the
looping area (Ex: A player is near the end of the looping area, and he can see an Object "in front of him" where the level
repeats, although that Object's position, at the beginning of the looping area) can not be
"properly" tested for collision unless this is accounted for manually, through the use of a Script Command such as
23 - LevelBound_X1
24 - LevelBound_X1
25 - LevelBound_Y1
26 - LevelBound_Y1
27 - LevelBound_X2
28 - LevelBound_X2
29 - LevelBound_Y2
30 - LevelBound_Y2
31 - Target_LevelBound_X1
32 - Target_LevelBound_X1
33 - Target_LevelBound_Y1
34 - Target_LevelBound_Y1
35 - Target_LevelBound_X2
36 - Target_LevelBound_X2
37 - Target_LevelBound_Y2
38 - Target_LevelBound_Y2
39 - XLoop_Active
40 - XLoop_Active
41 - YLoop_Active
42 - YLoop_Active
43 - BGOffsetX
44 - BGOffsetX
45 - BGOffsetY
46 - BGOffsetY
47 - XLoop_Size
48 - XLoop_Size
49 - YLoop_Size
50 - YLoop_Size
These values may be set manually, but it is recommended that they be set by use of
the _Player_SetTargetBounds" Script Command.