using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Obstacle : MonoBehaviour {
Rigidbody2D rb ;
public float moveSpeed ;
private void awake () {
GetComponent () ;
}
private void fixedUpdate ()
{
GetComponent ().velocity=( Vector2.left * moveSpeed);
}
void Update () {
if (transform.position.x < -5f)
Destroy(gameObject);
}
}
↧