using UnityEngine;
using System.Collections;
public class RocketScript : MonoBehaviour {
public Vector2 speed = new Vector2(0, 20);
public Vector2 downspeed = new Vector2(0, -20);
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void FixedUpdate () {
if (Input.GetKeyDown (KeyCode.DownArrow))
rigidbody2D.AddForce (downspeed);
if (Input.GetKeyDown (KeyCode.UpArrow))
rigidbody2D.AddForce (speed);
}
}
is my script but when i playtest it doesnt work-the sprite doesnt move (the rocket). Im not all that clear on how to use the addforce function and ive even read the docs but still not grasped it, so if anyone could help it would be very much appreciated.