-
Notifications
You must be signed in to change notification settings - Fork 1
The Group Block Type ‐ Full Overview
The group block type is an advanced block that creates a group depending on same colour neighbours inside the hitbox file. Those groups are solid until a player touches them and leaves, or a duration passes.
The mod provides four different colours that create a group if placed next to each other on the hitbox file. This is according to the four colour theorem and allows for any combination of groups. If you however find an example that requires five you may report your findings to the nearest academy.
Type | Red | Green | Blue | Description |
---|---|---|---|---|
A | 238 | 124 | 50 | BASIC version, groups with all neighbouring A type blocks |
A Ice | 238 | 124 | 51 | ICE version, groups with all neighbouring A type blocks |
A Snow | 238 | 124 | 52 | SNOW version, groups with all neighbouring A type blocks |
B | 50 | 124 | 238 | BASIC version, groups with all neighbouring B type blocks |
B Ice | 51 | 124 | 238 | ICE version, groups with all neighbouring B type blocks |
B Snow | 52 | 124 | 238 | SNOW version, groups with all neighbouring B type blocks |
C | 124 | 238 | 50 | BASIC version, groups with all neighbouring C type blocks |
C Ice | 124 | 238 | 51 | ICE version, groups with all neighbouring C type blocks |
C Snow | 124 | 238 | 52 | SNOW version, groups with all neighbouring C type blocks |
D | 50 | 238 | 124 | BASIC version, groups with all neighbouring D type blocks |
D Ice | 51 | 238 | 124 | ICE version, groups with all neighbouring D type blocks |
D Snow | 52 | 238 | 124 | SNOW version, groups with all neighbouring D type blocks |
Reset | 238 | 51 | 124 | Resets all groups to be solid, not solid |
Reset Solid | 238 | 54 | 124 | Resets all groups to be solid, solid |
<YOUR_MAP>/switchBlocksMod/blocks.xml
When the state switches, platforms rendered play their animation. To change the speed animations are played at define a Multiplier
tag.
The multiplier can be any integer or float number, with values above 1 speeding up the animation and values below 1 slowing the animation down. The default multiplier is 1.
<?xml version="1.0"?>
<Blocks xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Group>
<Multiplier>2</Multiplier>
</Group>
</Blocks>
To change how long the state is supposed to last define a Duration
tag containing an integer or float number. It should be noted that the game only updates every 17ms and as such the duration is limited to a multiple of this value (you can still enter a non-multiple value, the duration will be rounded up to the next 17ms multiple). The default duration is 3 seconds.
<?xml version="1.0"?>
<Blocks xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Group>
<Duration>5</Duration>
</Group>
</Blocks>
Normally a lever works from all sides. To disable a side define a LeverSideDisable
tag. This feature is limited to the solid lever type.
The tag contains a comma separated list of sides the lever is supposed to be disabled for. These sides are Up
, Down
, Left
, and Right
.
<?xml version="1.0"?>
<Blocks xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Group>
<LeverSideDisable>Down, Left, Right</LeverSideDisable>
</Group>
</Blocks>
Normally a platform works from all sides. To disable a side define a PlatformSideDisable
tag.
The tag contains a comma separated list of sides the platform is supposed to be disabled for. These sides are Up
, Down
, Left
, and Right
.
<?xml version="1.0"?>
<Blocks xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Group>
<PlatformSideDisable>Down, Left, Right</PlatformSideDisable>
</Group>
</Blocks>
As a normal prop does not interact with states custom rendering is required. The switch blocks mod provides its own way to render platforms and levers.
<YOUR_MAP>/switchBlocksMod/platforms/group
<YOUR_MAP>/switchBlocksMod/platforms/group/textures
Platforms are created by making a file called platforms1.xml
, the number in the filename responds to the screen the platforms are supposed to appear on. As such a file for platforms that were to appear on screen 8 should be called platforms8.xml
. Inside this file are the single platforms defined. To define a platforms the information required are Texture
and Position
. The Texture
has the name of an .xnb file inside the textures folder. The Position
has the X
and Y
of where the platform is supposed to be rendered, both values can be floats and are not required to line up with the position of a lever inside the level's hitbox containing file. Should the position of the platform line up with a hitbox position it will be linked to the group, however as mentioned it is not required for the position of a platform to line up with the hitbox file position, in this case the platform will not know to what group it belongs, a Link
tag is required containing hitbox position of a group block. The Link
has the X
, Y
and Screen
of where the platform is supposed to be linked to in screen coordinates (This is the hitbox position times 8). Optionally platforms may define the Animation
and AnimationOut
tags. If Animation
has been defined but AnimationOut
has not, Animation
will be used for both. This tag can contain Style
and Curve
used for the platforms animation. Styles are fade
, top
, bottom
, left
, and right
. By default the fade will be used fading the platform in and out. top
has the platform grow to its full size from the top, bottom
from the bottom, etc.
Curves are linear
, easeIn
, easeOut
, and easeInOut
. By default the linear will be used. Please look up animation curves for more information, as they will not be described here.
<?xml version="1.0"?>
<Platforms xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Platform>
<Texture>example_platform_texture</Texture>
<Position>
<X>300</X>
<Y>180</Y>
</Position>
<Link>
<Screen>4</Screen>
<X>240</X>
<Y>96</Y>
</Link>
<Animation>
<Style>bottom</Style>
<Curve>easeInOut</Curve>
</Animation>
<AnimationOut>
<Style>left</Style>
</AnimationOut>
</Platform>
</Platforms>
As mentioned, a normal prop does not interact with the state in any way. To convey information about the state the platform texture will only be rendered should its start state match the current state. It should be noted that the state of the blocks switches instantly and as such the animation "lags" behind. This should be considered when the animation is slowed down using the Multiplier
setting, as slowing the animation down could lead to unpleasant gameplay.
The block can convey information by playing a sound when a certain event occurs. It is optional to provide such an audio file.
<YOUR_MAP>/switchBlocksMod/audio
When the state switches the sound groupFlip
is played. Requires a platform to be on the screen. (visible or not does not matter)
The groups, each with its own state, animation progress, and tick activated as well as whether a reset has been touched, are saved to have them persist across sessions. This file is created automatically and should not be included in your steam upload.
<YOUR_MAP>/switchBlocksMod/saves/save_group.sav
To have consistent groups across sessions a file is created containing hitbox position and the associated group number. While this file, like the save, is created automatically, it should be included in your steam upload. The file gets created in the [OnLevelStart] step. Modifying this file allows for various effects like setting multiple groups to use the same group number syncing them up despite not being neighbours or even of the same colour. However do not use the 0 as a group number as this is used internally as "is not part of a group". Despite its .sav
file ending it can be opened like any text/.xml
file. Position stored in a single integer. X
and Y
can never be a three digit number. Screen
can never be a four digit number. As such the integers form is 0...00SSSXXYY
. While it might be awkward compared to using a more coherent representation like a Vector3, this is an optimization that significantly improves load times (~80% speedup). Counting begins from 0.
<YOUR_MAP>/switchBlocksMod/saves/cache_group.sav