Added Boost! if stalled out.


// This is how I added a 'Boost' in case the player stops too soon and needs to finish:
// In Unity PlayerController.cs:

 void Start()
    {        
              InvokeRepeating("Stalled", 5, 1);             // The actual timer function.
    }
    // -------------------------
    void Stalled()
    {
        timer--;
        bBoost = true;
    }

Update()
{

 if (bBoost)    // boost.  Do a boost if the snowboarder is stalled (stuck) for more than 5 seconds.

        {

            surfaceEffector2D.speed = speed + 10f;     // The Boost!

            dustParticles.Play();

            if (surfaceEffector2D.speed < 5f)
            {
                dustParticles.Stop();
            }
            bBoost = false;
        }

Files

snowboard1p6.zip Play in browser
Jan 13, 2023

Leave a comment

Log in with itch.io to leave a comment.