Alright, I have a complete script but the objects only move down?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bat_2_Controller : MonoBehaviour{
private Rigidbody2D rb;
// Use this for initialization
void Start () {
rb = this.GetComponent<Rigidbody2D> ();
}
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.UpArrow)) {
rb.velocity = new Vector2 (0f, 7f);
} if (Input.GetKey(KeyCode.DownArrow)) {
rb.velocity = new Vector2 (0f, -7f);
} else {
rb.velocity = new Vector2 (0f, 0f);
}
}
}
Ok So here's the code, and every time I hit play it the bats can move down and when I hit up it won't budge! I have the exact same script as my friend and their game works perfectly. Anything you guys can do to help? Thanks!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612110118im_/https://answers.unity.com/themes/thub/images/avi.jpg)