How to make virtual joystick (Windows Store)?

Hello, I need some help - I dont know how to make joystick. My idea is to make button (GUITexture) and programm it for change value of “Vertical axis” to 1 when press. I hope you understand it. I want just that button to imitate w/upper arrow. And I want four buttons for moving and one to jump, my problem is that I dont know how to programm this (my lang is C#).


More ‘graphic’ presentation of my idea:

  • BUTTON1 → tap → Vertical axis = 1;
  • BUTTON1 → !tap → Vertical axis = 0;
  • BUTTON2-> tap → Vertical axis = -1;
  • BUTTON2-> !tap → Vertical axis = 0;

Create Methods that are to accept the button commands:

void OnButton1Click()
{
//Handle Button 1 Click
}
void OnButton2Click()
{
//Handle Button 2 Click
}

Then on the guitexture, you can just send a message to the object with the script above:

receivingObject.SendMessage("OnButton1Click"); 

And finally, in the same object as the receiver methods:

bool button1Pressed = false;

void Update()
{
  if(button1Pressed)
  {
    //Vertical axis = 1;
    button1Pressed = false;
  }
  else
  {
    //Vertical axis = 0;
  }
}

void OnButton1Click()
{
  button1Pressed = true;
}