> For the complete documentation index, see [llms.txt](https://steijn.gitbook.io/devlogs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://steijn.gitbook.io/devlogs/devlog-client/tutorial.md).

# Tutorial/objectives

#### What is the problem I want to solve?

For our tutorial i've set out to use Lex's steps as a stepping stone. <br>

#### How will/did I solve this?

We need an adjustable text, it needs to go through the steps as you go and change them when you reach the next tutorial objective

#### What is the result?

I've decided to do it the simple way using ifstatements.&#x20;

```
    //go through steps
    if (tutorialIndex == 0)
    {//first tutorial step move camera
        if (movedForward && movedBack && movedRight && movedLeft) // player action
        {
            tutorialIndex++;
            StartCoroutine(FadeOutText(1f, textToUse, "Press Q and E to rotate the camera"));
        }
    }
    else if (tutorialIndex == 1 && FadeFinished == true)
    {//rotate camera 
    
```

This way the tutorial is pretty adjustable and easy to implement. \
We're starting with the camera controls. \
\
we decided that to show "WASD" as movement controls we'd take away the letters when you pressed them and only continue when this was done.&#x20;

This required me finding a way to remove the certain letters we were using and i managed to do it using

```
   textToUse.text = textToUse.text.Replace("W", "");
```

This replaces the letter that was pressed with nothing and thus removes it from the text. \
Later we also wanted to make the text fade in/out when you succeeded an objective. for this i had to make a [Coroutine](https://stackoverflow.com/questions/56031067/using-coroutines-to-fade-in-out-textmeshpro-text-element)

```
    private IEnumerator FadeInText(float timeSpeed, TextMeshProUGUI text)
    {
        FadeFinished = false;
        text.color = new Color(text.color.r, text.color.g, text.color.b, 0);
        while (text.color.a < 1.0f)
        {
            text.color = new Color(text.color.r, text.color.g, text.color.b, text.color.a + (Time.deltaTime * timeSpeed));
            yield return null;
        }
        FadeFinished = true;
    }
```

Using this i've been able to make the text fade in and out. It did provide me some more insights on how to adjust strings properly and how to use coroutines to do what i need

#### What is the quality of the result?

My group agreed that this was a good enough solution to our current project due to time constraints. \
i had it tested by some users and they also agreed it was good enough, it covered the basic controls and leaves the player open to do as he wants. \
It also met our definition of done.

#### What is the next step now I have this result

I will implement the tutorial in the main scene and get it integrated with the objectives and hud.
