Glue:GlueVault:Component Pages:PlatformerCharacterBase:CSV Variables

Introduction

This section discusses the variables in the Platformer CSV which can be used to modify how the PlatformerCharacterBase entity moves in your game. If you are not familiar with the CSV file format you may want to check the CSV intro page.

Modifying existing MovementVariables

The CSV which is included with PlatformerCharacterBase can be modified easily. Also, you can add additional rows in the CSV to add more options without eliminating existing values.

To modify the CSV, simply double-click the CSV file under the PlatformerCharacterBase’s Files item. It will open in your default CSV editor (such as Excel or Open Office).

Once the CSV has been opened, simply modify the existing values in a CSV or add additional rows to create new movement variables.

The following explains what each variable does:

Name

The name for the collection of variables. This value will show up in the Glue combo boxes when changing the variable value. It can also be used to programatically set the movement variables.

MaxSpeedX

The maximum horizontal movement speed of the character in units per second. If your game is using pixel coordinates, then that will also correspond to pixels per unit. Increasing this value will make the character move faster.

AccelerationTimeX

The amount of time that the character takes to get to his maximum velocity. If this value is 0, then the character will reach his maximum speed immediately (similar to the controls of popular NES games like Mega Man, Contra, Kid Icarus, and Metroid). Setting a non-zero value will result in the character accelerating up to maximum speed. Horizontal movement with acceleration is common in most modern platformers, but can be found even in older games such as Super Mario Bros. on the NES. Increasing this value will make it take longer to accelerate to max speed, making the character feel more sluggish, or will make the ground feel more slippery.

DecelerationTimeX

The amount of time that the character takes to stop from maximum velocity. This value should not be larger than AccelerationTimeX. A smaller value will make the character stop faster and feel more responsive. A larger value will make the character feel more sluggish, or will make the ground feel more slippery.

Gravity

The downward force which makes the character fall. This value controls the rate at which YVelocity decreases per second. Making this value larger will make the character fall faster. It will also reduce the character’s ability to jump as high. Keep in mind that if you want to make the character fall slower, you should use MaxFallSpeed instead of Gravity.

MaxFallSpeed

The maximum speed that the character can fall at – also known as “terminal velocity”. Increasing this value will make the character fall faster, however it can also result in the character falling through the floor. Reducing this value can make the character fall slower and feel as if he is floating. This value is useful for slowing falls down in response to powerups such as the cape in Super Mario World and the raccoon tail in Super Mario Bros. 3. Reducing this value can also be an effective way to give the player the feeling of being in water.

JumpVelocity

The velocity that is set on the character when the jump button is pressed on the ground. Increasing this value will make the character jump higher.

JumpApplyLength

The amount of time that the jump velocity is applied to the character when the jump button is pressed. If this value is set to 0 then pressing the jump button will set the velocity at the instant that the button was pressed, and only for that frame. Gravity will then immediately take effect. Setting a non-zero allows for variable-height jump, and can also be used to implement swimming (see the next value).

JumpApplyByButtonHold

Controls whether the JumpApplyLength is tied to how long the button is held down, or if the value is always applied for the specified amount of time:

  • If JumpApplyByButtonHold is true then the amount of time that the JumpVelocity is applied for depends on how long the player holds down the jump button. This allows the player to control the character’s jump height by holding the button down after jumping or by releasing the button immediately after the press.
  • If JumpApplyByButtonHold is false, then the velocity will always be applied for the same amount of time (specified by JumpApplyLength). This is useful for simulating flying by flapping wings or swimming.