Base mechanics done

This commit is contained in:
Gerard Gascón 2023-08-20 17:27:37 +02:00
parent e4cc23e7f0
commit eaa8cdd462
67 changed files with 21667 additions and 330 deletions

View file

@ -1,16 +1,22 @@
using UnityEngine;
namespace Level8 {
public class Bullet8 : MonoBehaviour {
[SerializeField] float speed;
public class Bullet8 : BulletStats {
void FixedUpdate() {
if (Rb.velocity.y <= maxYSpeed) return;
Vector2 velocity = Rb.velocity;
velocity.y = maxYSpeed;
Rb.velocity = velocity;
}
public void AddForce(int direction) {
Rigidbody2D rb = GetComponent<Rigidbody2D>();
rb.velocity = Vector2.right * direction * speed;
GetComponent<Rigidbody2D>().velocity = Vector2.right * direction * bulletSpeed;
}
void OnCollisionEnter2D(Collision2D other) {
Destroy(gameObject);
if (other.gameObject.CompareTag("Enemy")) {
Destroy(gameObject);
}
}
}
}