Forum begins after the advertisement:


Part 6: errors on spikes script

Home Forums Video Game Tutorial Series Creating a Metroidvania in Unity Part 6: errors on spikes script

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #18918
    Tyler Fruge
    Level 5
    Participant
    Helpful?
    Up
    0
    ::

    I keep getting two errors on the spikes script and i don’t know how to fix them.

    View post on imgur.com

    spikes script:

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    
    public class Spikes : MonoBehaviour
    {
        // Start is called before the first frame update
        void Start()
        {
    
    
        }
    
    
        // Update is called once per frame
        void Update()
        {
    
        }
    
    
        private void OnTriggerEnter2D(Collider2D _other)
        {
            if (_other.CompareTag("Player"))
            {
                StartCoroutine(RespawnPoint());
            }
        }
    
    
        IEnumerator RespawnPoint()
        {
            PlayerController.Instance.pState.cutscene = true;
            PlayerController.Instance.pState.invincible = true;
            PlayerController.Instance.rb.velocity = Vector2.zero;
            Time.timeScale = 0;
            StartCoroutine(UIManager.Instance.sceneFader.Fade(SceneFader.FadeDirection.In));
            PlayerController.Instance.TakeDamage(1);
            yield return new WaitForSeconds(1);
            PlayerController.Instance.transform.position = GameManager.Instance.platformingRespawnPoint;
            StartCoroutine(UIManager.Instance.sceneFader.Fade(SceneFader.FadeDirection.Out));
            yield return new WaitForSeconds(UIManager.Instance.sceneFader.fadeTime);
            PlayerController.Instance.pState.cutscene = false;
            PlayerController.Instance.pState.invincible = false;
            Time.timeScale = 1;
        }
    }
    #18919
    Terence
    Level 31
    Keymaster
    Helpful?
    Up
    0
    ::

    Change the rb variable in PlayerController from private to public, and change the fadeTime variable in SceneFader from private to public as well.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: