Implemented a movement controller.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Bullet : MonoBehaviour
|
||||
{
|
||||
Rigidbody2D rb;
|
||||
public float damage;
|
||||
public float time = 2f;
|
||||
|
||||
public void ApplyVel(Vector2 dir,float speed) {
|
||||
rb = GetComponent<Rigidbody2D>();
|
||||
rb.velocity = dir * speed;
|
||||
Destroy(gameObject, time);
|
||||
}
|
||||
private void OnCollisionEnter2D(Collision2D c) {
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user