cnam-geometry-dash/Assets/Scripts/SpikeScript.cs

25 lines
565 B
C#

using UnityEngine;
public class SpikeScript : MonoBehaviour
{
public PlayerScript playerScript;
public GameObject playerObject;
public void Start()
{
playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerScript>();
}
public void Update()
{
}
public void OnTriggerEnter2D(Collider2D collision)
{
playerObject.transform.rotation = playerScript.initialRotation;
playerObject.transform.position = playerScript.initialPosition;
playerScript.isColliding = false;
}
}