Hi ,
I’m making a 2D platformer game and I put GUITextures as buttons on screen for input
Here’s my script for the Right arrow GUITexture " To move the player to the right "
var holding : boolean = false;
var speed : float = 0;
var speedincrease : float = 1;
function OnMouseDrag () {
holding = true;
speed += speedincrease * Time.deltaTime;
}
function OnMouseUp () {
holding = false;
speed = 0;
}
I attached this script to the GUITexture and it works fine
And this script is for the Jump GUITexture button
var holding : boolean = false;
function OnMouseDown () {
holding = true;
}
function OnMouseUp () {
holding = false;
}
both scripts work fine , but when I click on the jump button while running , the player doesn’t jump … How Can I make the player able to press two buttons at the same time and make them both work ?
Thanks in advance …