Time for action – tweak the hero

There are a few changes we should make to the HeroShip Script (formerly the Character Script) to suit our new game. Let's do it:

  1. Open the HeroShip Script.
  2. Delete the else if condition handling the steins. Get rid of everything in this snippet in bold:
    if(col.gameObject.tag == "bomb")
    {
        audio.PlayOneShot(explosionSound);
        Instantiate(explosion, col.gameObject.transform.position,
            Quaternion.identity);
    } else if (col.gameObject.tag == "stein") {
        animation.Play("catch"); // Ima catch that stein!
    }
    

    Shoot the Moon doesn't have beer steins, so we can safely kill this chunk.

  3. Delete all of the code controlling the character model animation. Get rid of this whole section in bold:
    if(lastX != transform.position.x) {
     // x values ...

Get Unity 4.x Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.