Base mechanics done
This commit is contained in:
parent
e4cc23e7f0
commit
eaa8cdd462
67 changed files with 21667 additions and 330 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue