How should I name cardinal directions to correspond to character movement?

Hi,

I’m new to programming and have been piecing together sample code to create a game while I learn the ropes. I’m using EX2D to animate my sprites. I’m trying to use the following script to assign a specific animation to each direction the character moves while up, down, left, or right is pressed. How should I name Vertical and Horizontal in the GetButton statements to correspond to each cardinal direction?

Right now, the only error I get is “Object reference not set to an instance of an object”

Thanks!

var sprite: exSprite;

    function Start () {

    }

    function Update () {

while(Input.GetButton("Vertical"))
 { 
 sprite.spanim.Play("PlayerWalkUpAnimation");
 }
while(Input.GetButton("Vertical"))
 { 
 sprite.spanim.Play("PlayerWalkDownAnimation");
 }
while(Input.GetButton("Horizontal"))
 { 
 sprite.spanim.Play("PlayerWalkLeftAnimation");
 }
while(Input.GetButton("Horizontal"))
 { 
 sprite.spanim.Play("PlayerWalkRightAnimation");
 }

}

Use Input.GetAxis, and define the buttons used in the Input Manager.

you can do it in Input Manager