-
Notifications
You must be signed in to change notification settings - Fork 1
The Auto Block Type ‐ Full Overview
The auto block type is a timed gimmick. They automatically switch from solid to non-solid and vice versa when a certain amount of time has passed.
Type | Red | Green | Blue | Description |
---|---|---|---|---|
On | 238 | 124 | 10 | BASIC version, solid when the state is ON |
On Ice | 238 | 124 | 11 | ICE version, solid when the state is ON |
On Snow | 238 | 124 | 12 | SNOW version, solid when the state is ON |
Off | 10 | 124 | 238 | BASIC version, solid when the state is OFF |
Off Ice | 11 | 124 | 238 | ICE version, solid when the state is OFF |
Off Snow | 12 | 124 | 238 | SNOW version, solid when the state is OFF |
Reset (Time only) | 238 | 11 | 124 | Resets the amount of time that has passed |
Reset (Time + State) | 238 | 12 | 124 | Resets the amount of time that has passed, as well as state |
<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">
<Auto>
<Multiplier>2</Multiplier>
</Auto>
</Blocks>
To change how long the state is supposed to last define a Duration
tag containing an integer or float number. Optionally a DurationOff
tag can be defined, giving the off state its own duration. If Duration
has been defined but DurationOff
has not, Duration
will be used for both. 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">
<Auto>
<Duration>5</Duration>
</Auto>
</Blocks>
- Select music that has one solid tempo throughout
- Figure out the bpm (technically optional, but this lets you skip counting bars manually)
- Determine the amount of bars (#bars) either through math or counting. It's probably a multiple of 4
- Cut audio to loop perfectly (Audacity)
- Divide loop length by #bars to get a duration
- Multiply duration by 100/102, then round duration to the nearest 17ms, set this value in blocks.xml
- Multiply new duration by 102/100 and #bars to get a new loop length
- Speed up/down song to match the new loop length as closely as possible (Audacity)
- Sync up the start of the song with the auto timer in-game using a forcibly synced screen transition
- This may be good enough for your purposes, but will likely still be off. If you want to improve it further, then record footage in-game and figure out the exact length you need the music loop to be, and adjust the song length accordingly. This will take some trial and error to perfect and is a very tedious process. Bear in mind when you edit .mp3 files there will be about 40-45ms of silence added at the start each time.
Lastly, the audio quality will degrade if you shifted the tempo without the pitch in step 8, or it will be slightly out of tune if you adjust both (this only matters if for some reason you want to harmonize with other sounds)
To provide feedback and a warning of an incoming switch before it happens a warn sound can be played. The amount of times this sound is played as well as the duration between warnings can be modified using the Count
and Duration
tags placed inside a Warn
Tag. The specified duration is the time between warnings, therefore should the duration be 1 second and the amount 4 times the warnings sounds will play the first time 5 seconds before the switch, and then 3 more times 1 second apart from each other so that the fourth warning will be played 1 second before the switch. The count is an integer number but the duration can be an integer or float. The default amount is 2 and the default duration is 1 second. Should it be wanted that the sound does not play for a certain state use DisableOn
to disable the sound played when the state is on, and DisableOff
for the off state.
<?xml version="1.0"?>
<Blocks xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Auto>
<Warn>
<Count>1</Count>
<Duration>1.5</Duration>
<DisableOff />
</Warn>
</Auto>
</Blocks>
Under normal circumstances it is never wanted for the player to be inside a block as it turns solid, this creates problems for the game as behaviours do not work as intended. Should the player find themselves inside a solid block they will move with their current velocity until they reach a point where they are no longer in an invalid position. To prevent this the platforms will not switch to solid should a player currently occupy a position that would result in this problem. The switch will be delayed until the player has left and switching is safe to do, this behaviour however can be disabled. (This is NOT recommended and should only be considered if this is actively intended)
<?xml version="1.0"?>
<Blocks xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Auto>
<ForceStateSwitch />
</Auto>
</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/auto
<YOUR_MAP>/switchBlocksMod/platforms/auto/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
, Position
, and StartState
. 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. 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 Animation
and AnimationOut
tags. If Animation
has been defined but AnimationOut
has not, Animation
will be used for both. These tags 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>368</X>
<Y>296</Y>
</Position>
<StartState>on</StartState>
<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 autoFlip
is played. The sound is played even when a player is inside a block and safe switching is delaying the actual switch. Requires a platform to be on the screen. (visible or not does not matter)
When a warning is supposed to occur the sound autoWarn
is played. Requires a platform to be on the screen. (visible or not does not matter)
The state, whether a switch can occur safely, should a switch occur as soon as it is safe to do so, animation progress, the amount a warning has played, and the last tick a reset block 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_auto.sav