ofb/Assets/Scripts/Launch.cs
slevy14 275763628b reconfigured collision
also made some adjustments to player behavior and controller
2023-04-17 15:22:24 -07:00

18 lines
646 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Launch : MonoBehaviour {
[SerializeField] GameObject tambourine;
[SerializeField] private float horizSpeed;
[SerializeField] private float vertSpeed;
public void ThrowTambourine(float facing) {
GameObject newTambourine = Instantiate(tambourine, this.gameObject.transform.position, this.gameObject.transform.rotation);
// multiply horizSpeed by facing if not using moving launch point
newTambourine.GetComponent<Rigidbody2D>().AddForce(new Vector2(horizSpeed * facing, vertSpeed), ForceMode2D.Impulse);
}
}