Skip to content

The Sand Block Type ‐ Full Overview

Adrian K edited this page Jan 5, 2025 · 5 revisions

The sand block type is a block behaving like the vanilla sand block, however the direction of movement can be toggled. They are not timed or have any function besides being either vanilla or reverse vanilla.

Colours

Type Red Green Blue Description
On 238 124 40 Moving the player upwards when the state is ON
Off 40 124 238 Moving the player upwards when the state is OFF
Lever 238 41 124 Switches the state from ON to OFF and vice versa, not solid
Lever On 238 42 124 Switches the state from OFF to ON, not solid
Lever Off 238 43 124 Switches the state from ON to OFF, not solid
Lever Solid 238 44 124 Switches the state from ON to OFF and vice versa, solid
Lever Solid On 238 45 124 Switches the state from OFF to ON, solid
Lever Solid Off 238 46 124 Switches the state from ON to OFF, solid

Settings

File Location

<YOUR_MAP>/switchBlocksMod/blocks.xml

Multiplier

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.

Doubling the speed of animations with a Multiplier tag.

<?xml version="1.0"?>
<Blocks xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Sand>
        <Multiplier>2</Multiplier>
    </Sand>
</Blocks>

LeverSideDisable

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.

Disabling the lever if touched from the bottom, left, and right with a LeverSideDisable tag

<?xml version="1.0"?>
<Blocks xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Sand>
        <LeverSideDisable>Down, Left, Right</LeverSideDisable>
    </Sand>
</Blocks>

Rendering

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.

Levers

File Locations

<YOUR_MAP>/switchBlocksMod/levers/sand

<YOUR_MAP>/switchBlocksMod/levers/sand/textures

Creating levers

Levers are created by making a file called levers1.xml, the number in the filename responds to the screen the levers are supposed to appear on. As such a file for levers that were to appear on screen 8 should be called levers8.xml. Inside this file are the single levers defined. To define a lever 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 lever 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.

Creating a lever

<?xml version="1.0"?>
<Levers xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Lever>
        <Texture>example_lever_texture</Texture>
        <Position>
            <X>176</X>
            <Y>336</Y>
        </Position>
    </Lever>
</Levers>

Lever texture

As mentioned, a normal prop does not interact with the state in any way. To convey information about the state the lever texture contains both the ON and OFF state in its texture. The texture does this by rendering the left half of the texture should the state be ON and the right half should the state be off.

Platforms

File Locations

<YOUR_MAP>/switchBlocksMod/platforms/sand

<YOUR_MAP>/switchBlocksMod/platforms/sand/textures

Creating platforms

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 Background or Foreground (at least one), Position, and StartState. The Background/Foreground 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. The StartState is either on or off, this will ensure the platform renders should the state of the block type be equal to the start state. Optionally platforms may define the Scrolling tag. This is an additional texture containing the sand like animated texture.

Creating a platform

<?xml version="1.0"?>
<Platforms xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Platform>
        <Background>example_background</Background>
        <Scrolling>example_scrolling</Scrolling>
        <Position>
            <X>432</X>
            <Y>104</Y>
        </Position>
        <StartState>on</StartState>
    </Platform>
</Platforms>

Platform texture

The platform requires a background or foreground texture to be set, this texture determines the size used for the platforms scrolling animation. To convey information about the state the platform texture contains both the ON and OFF state in its texture. The texture does this by rendering the left half of the texture should the state be ON and the right half should the state be off. The scrolling texture should be at least as tall as the background/foreground and half as wide (as wide as one of the states). This texture will be looped and the top and bottom will be next to each other.

Audio

The block can convey information by playing a sound when a certain event occurs. It is optional to provide such an audio file.

File Location

<YOUR_MAP>/switchBlocksMod/audio

Audio played when the state switches

When the state switches the sound sandFlip is played. Requires a platform to be on the screen. (visible or not does not matter)

Save

The state, whether a lever has been touched, and if the player is currently inside are saved to have them persist across sessions. This file is created automatically and should not be included in your steam upload.

File Location

<YOUR_MAP>/switchBlocksMod/saves/save_sand.sav