- Home /
Question by
WrecklessCookie · Apr 03, 2014 at 02:34 PM ·
horizontal movement
Why isn't this input working?
I tried putting two keys doing the same action, but it gives me an
Assets/Scripts/BallControl.js(15,29): BCE0077: It is not possible to invoke an expression of type 'boolean'
I'm fairly new to making games and coding ^^ all help would make my day
#pragma strict
var rotationSpeed = 200;
var jumpHeight = 9;
private var isFalling = false;
function Update ()
{
var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed;
rotation *= Time.deltaTime;
rigidbody.AddRelativeTorque (Vector3.back * rotation);
if (Input.GetKeyDown(KeyCode.Space)(Input.GetKeyDown(KeyCode.UpArrow) && isFalling == false))
{
rigidbody.velocity.y = jumpHeight;
}
isFalling = true;
}
function OnCollisionStay ()
{
isFalling = false;
}
Comment
Answer by AlucardJay · Apr 03, 2014 at 02:37 PM
It looks like you are missing an operator at line 15 (between KeyCode.Space and KeyCode.UpArrow):
if (Input.GetKeyDown(KeyCode.Space)(Input.GetKeyDown(KeyCode.UpArrow) && isFalling == false))
I can only guess you want to check if (( Space or UpArrow is down ) and is falling is false)
if ( (Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.UpArrow)) && isFalling == false )
Your answer
Follow this Question
Related Questions
Rolling ball with Horizontal Input 1 Answer
How can I make my character jump & move him by zone 0 Answers
Rotation too complicated 3 Answers
how can i instantly change the the direction of a force and speed aplyd to a 2D object 1 Answer
How to drag and move a character left and right using touch controls in an endless runner game? 0 Answers