SidescrollerMovement
This script is an advanced version of the Sidescroller Movement script included with Unity's Mobile Standard Assets. It has been converted to C# and modified to be more configurable. By default, the character this is added to will be able to move left and right along the X axis. The class has flags that can be set to enable jumping in the Y axis and movement in the Z axis. There are also settings that will allow the character to run if enabled.
Contents |
Public Variables
canMoveInZ : bool
Whether or not the character takes vertical input to move in the Z direction.
movementSpeed : float
How fast the character moves.
canRun : bool
Whether or not the character can run.
runSpeed : float
How fast the character moves when running.
canJump : bool
Whether or not the character can jump.
jumpSpeed : float
How fast the character jumps.
inAirMultiplier : float
Limiter for ground speed while jumping.
horizontalAxisName : string
The name of the axis from which the horizontal input is taken. This is translated into X axis motion.
verticalAxisName : string
The name of the axis from which the vertical input is taken. This is translated into Z axis motion (if enabled).
runningButtonName : string
The name of the button which, when pressed, will let the character run.
jumpButtonName : string
The name of the button that allows the button to jump.
Example
The toolbox contains a prefab and a demo scene showing how the Sidescroller Movement script can be used.