I am trying to make a top down game where the enemy continuously moves up and down. This is my code so far.
using UnityEngine;
using System.Collections;
public class EnemyRandomMovement : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.position = new Vector3 (transform.position.x, transform.position.y - 0.1f, 0f);
}
}
I’m actually unsure what to do now. (I’m a beginner)
I just need the enemy to bounce off the background box collider and switch directions.