Day 1 Finished! Got the bare bones of the game functional. It's basically a game without any polish at the smallest scope possible.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BulletScript : MonoBehaviour
|
||||
{
|
||||
public float speed;
|
||||
|
||||
private Rigidbody2D rb;
|
||||
|
||||
void Start()
|
||||
{
|
||||
rb = GetComponent<Rigidbody2D>();
|
||||
}
|
||||
|
||||
void FixedUpdate()
|
||||
{
|
||||
|
||||
rb.velocity = transform.up * speed;
|
||||
|
||||
}
|
||||
|
||||
void OnCollisionEnter2D(Collision2D other)
|
||||
{
|
||||
|
||||
if(other.gameObject.tag != "Player")
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
if(other.gameObject.tag == "Player")
|
||||
{
|
||||
Physics2D.IgnoreCollision(
|
||||
other.gameObject.GetComponent<Collider2D>(), GetComponent<Collider2D>());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OnBecameInvisible()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user