Typewriter Effect?

Greetings!

I was browsing some of the other finished Terminal Hacker projects and noticed some had the super cool letter-by-letter typewriter effect going on. And I would love to implement that into my own game as well.

Would this be too tricky for a beginner to try to implement this early on? I’ve been searching online but only tend to find outdated info (using GUIText) or stuff that seems out my scope relative to tying it into the provided assets.
Also, there’s a small lil $2 asset in the store that is suppose to do exactly what I want, but on use is only causing the Lorem Ipsum text to occassionally flash over what is shown via Terminal.WriteLine().

Could anyone point me in the direction of how to implement this effect (or asset) in regards to the WM2000 package we got?
Thanks all :3

Not entirely sure if you are asking how to implement the sound effect into a separate game you are making? If so I would probably suggest continuing with the course until they discuss adding audio clips and music etc, i’m sure it is on the way.

Or are you asking about the Hacker game you are making as you go through the section. It should happen pretty much by default (at least mine did), I would check you imported everything by having a look in the WM2000 assets and making sure you have the audio clips and script.

Hopefully someone else will be able to help a bit more than me Good Luck :grinning:

I’m not sure about the WM2000 package or even what is is but this should be fairly easy to do.

Get a new game object with an Audiosource component. Then download a single sound clip of a key press, I rather like this one. Attach the clip to the Audiosource and finally add a new script to the object and use the following:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AnyKeyPress : MonoBehaviour {

    private AudioSource audioSource;

	void Start () {
        audioSource = GetComponent<AudioSource>();
	}
	
	void Update () {
        if (Input.anyKeyDown) audioSource.Play();
    }
}

anyKeyDown returns true every key stroke and will then force the sound to play.

Wondering if you are talking asking about having the text appear character by character, not for what the player types, as the project package supoorts this, but as in when you output your tect to the terminal for the player to see. Is this what you are referring to?

Yes, Rob, that’s exactly the question. :smiley:
Nothing to do with the audio or the actual project package per se.

1 Like

You can achieve this effect using coroutines and WaitForSeconds. Its not covered in the Terminal Hacker section but you will encounter this later in the course.

Why not give it a go yourself and see what you can do.

My suggestion would be to start with an empty scene, a seperate script attached to a GameObject and see if you can make two strings of text appear, one after the other by a specified delay.

If you get that working, you are half way there on getting the result you want for the main output in the game.


See also;

1 Like

Thanks so much, Rob! This is exactly what I was looking for.
I’m definitely gonna give it a shot!

1 Like

Pop a little video clip up perhaps to show other students what can be achieved :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms