Kuru Kuru

First ever game

Engine Icon Platform Icon solo Engine Icon Platform Icon solo

My Work

using UnityEngine;

public class ObstaclePP : MonoBehaviour
{
    [SerializeField] private Rigidbody2D player;

    [Header("Push")]

    [SerializeField] private float pushForceL1;
    [SerializeField] private float pushForceL2;
    [SerializeField] private float pushForceL3;

    [Header("Pull")]
    [SerializeField] private float pullForceL1;
    [SerializeField] private float pullForceL2;
    [SerializeField] private float pullForceL3;

    void Start()
    {
        if (player == null)
            player = GetComponent();
    }

    private void OnTriggerStay2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("pushG"))
        {
            player.AddForce(other.transform.up * pushForceL1);
        }
        else if (other.gameObject.CompareTag("pushB"))
        {
            player.AddForce(other.transform.up * pushForceL2);
        }
        else if (other.gameObject.CompareTag("pushR"))
        {
            player.AddForce(other.transform.up * pushForceL3);
        }
        else if (other.gameObject.CompareTag("pullG"))
        {
            player.AddForce(-other.transform.up * pullForceL1);
        }
        else if (other.gameObject.CompareTag("pullB"))
        {
            player.AddForce(-other.transform.up * pullForceL2);
        }
        else if (other.gameObject.CompareTag("pullR"))
        {
            player.AddForce(-other.transform.up * pullForceL3);
        }
    }
}
                                    

oops something whent wrong, reload the page

private void OnTriggerEnter2D(Collider2D other)
{

 if (other.gameObject.CompareTag("switch"))
  {
    if (isGreen == false)
    {
        isGreen = true;
    }
    else if (isGreen == true)
    {
        isGreen = false;
    }
  }
                                    
 if (isGreen == false && other.gameObject.CompareTag("Gwall"))
  {
     if (spawnState == 6)
     {
         transform.position = new Vector2(36.74f, -43.5f);
     }
     if (spawnState == 7)
     {
         transform.position = new Vector2(65.13f, -95.92f);
     }
  }
 if (isGreen == true && other.gameObject.CompareTag("Pwall"))
  {
     if (spawnState == 6)
     {
         transform.position = new Vector2(36.74f, -43.5f);
     }
     if (spawnState == 7)
     {
         transform.position = new Vector2(65.13f, -95.92f);
     }
  }
}
                                    

oops something whent wrong, reload the page

About the game

Technique