Added moving and teleporting platforms in ObstanceWIP. Falling Platform is a WIP

Falling Platforms don't work yet. Still haven't figured out how to make it fall
This commit is contained in:
TGall8
2025-02-28 17:46:02 -05:00
parent 189aab2fd8
commit 8543734eb9
10 changed files with 1223 additions and 88 deletions

View File

@@ -0,0 +1,28 @@
using UnityEngine;
public class TeleportPlatform : MonoBehaviour
{
public Vector2 teleportPoint;
//public bool teleportPosition = false;
public string teleportTag;
//private void Start()
//{
//if (teleportPosition)
//{
//teleportPoint = transform.position;
//}
//}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.CompareTag(teleportTag))
{
transform.position = teleportPoint;
if (TryGetComponent<Rigidbody2D>(out var rb))
{
rb.linearVelocity = Vector2.zero;
}
}
}
}