Basic player movement
This commit is contained in:
parent
9fdca82032
commit
32f5ed6299
36 changed files with 10406 additions and 466 deletions
17
Assets/Scripts/Bullet1.cs
Normal file
17
Assets/Scripts/Bullet1.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Bullet1 : MonoBehaviour {
|
||||
[SerializeField] float speed;
|
||||
|
||||
public void AddForce(int direction) {
|
||||
Rigidbody2D rb = GetComponent<Rigidbody2D>();
|
||||
rb.velocity = Vector2.right * direction * speed;
|
||||
}
|
||||
|
||||
void OnCollisionEnter2D(Collision2D other) {
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue