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

24 lines
523 B
C#
Raw Permalink Normal View History

2024-12-16 16:19:59 +01:00
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;
}
}