This commit is contained in:
Gerard Gascón 2025-04-24 14:23:29 +02:00
commit bd5b1556ff
269 changed files with 6249829 additions and 0 deletions

22
Assets/Scripts/Bullet.cs Normal file
View file

@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bullet : MonoBehaviour{
public float speed;
Rigidbody2D rb2d;
void Start(){
rb2d = GetComponent<Rigidbody2D>();
rb2d.AddRelativeForce(Vector2.right * speed, ForceMode2D.Impulse);
}
void OnCollisionEnter2D(Collision2D col){
if(col.gameObject.tag == "Dragon"){
FindObjectOfType<Dragon>().TakeDamage(5);
}
Destroy(gameObject);
}
}