JELLE VAN DOORNE - GAME & NARRATIVE DESIGN
  • Home
  • Portfolio
    • Angela's Wedding Disaster
    • Angela's High School Reunion
    • Angela's Fashion Fever
    • Viola
    • Press Q To Stop Time
    • SECRET
  • Blog
  • About
  • Contact
  • Presskit

How to Blatantly Steal a Mechanic from Zelda

14/4/2018

0 Comments

 
This week I worked on a new mechanic for Viola: playing her trusty little violin. I loved the Nintendo 64 Zelda games and I loved the Ocarina mechanic, letting the player feel like they're playing music with very simple controls.

Click "read more" to find out a little more about the process.

Song of Guiding Light

The mechanic is really quite straight-forward. Press RB to start playing, then press the face and direction buttons to play. Play the correct order, and you'll get the whole song!
Picture
Picture
Picture
Picture
Picture
Collection of art elements created for the mechanic.
The code is not that complicated, but it is very widespread. To make the mechanic work, the following things happen almost all at the same time:
  • Zoom the camera in using Cinemachine
  • Fade out the background music
  • Change the UI to add a music sheet, and change the RB button to say 'Back'
  • Stopping player control
  • Start reading inputs
  • Play sounds and add notes to the music sheet...
  • ...and finally, keep track of which notes have been played!
All this code is sorted between three scripts added to the player character. "Play Instrument" does most of the actual work: stopping control, reading inputs, changing UI and camera, and playing sounds.

"Note Handler"'s job is really just to keep track of the notes that have been played by using a lot of booleans. It displays the buttons on the UI, and has a 'refresh' function that resets which buttons have been played.
f I was a better programmer, I would've used arrays to make the amount of code smaller.

Finally, "Song Handler" plays the song. Simple. A few delays are used here and there to make sure the player can register what they've played and whether they succeeded or failed.
Picture
Picture
All the actions are done in the Play Instrument script, which points at a lot of stuff and tells various voids in various areas of the game to do their job.

From top to bottom:
  1. Switch off a bool in PlayerControl, disabling the player's ability to move.
  2. Do the same for jumping.
  3. Activate a void in the background music object that slowly lowers the volume, then pauses the background music.
  4. Change the "priority" of the player camera. This tells the Cinemachine brain to slowly change to another camera, effectively 'zooming in'.
  5. Change a bool in the animator to change Viola's animation.
  6. Change the image for the UI button.
  7. Show the music sheet UI with a fade.

"StopInstrument()" does the same thing, except in reverse. It also changes back the UI text to nothing, which effectively turns off the display. Changing the song text UI is added to the SongHandler script instead, because that script contains data on what the actual name of the song is.

I prefer activating voids on other scripts so the player object isn't logged with variables it doesn't need. For instance, "imageChange()" is just two lines of code, but it does require two images, which would have to show up as variables on the script. They're not actually related to the player, so I put them on their own objects instead.
You might wonder a little bit about the song itself, right? It's a violin cover of a song from a show called "Violet Evergarden". The similar name is not a coincidence either: I love the show and briefly wanted to name Viola "Violet" instead. I changed it to Viola, instead, which in turn gave me the idea to give the main character a violin as her instrument. The performance can be found here:
This is just temporary music, but I do love the feel behind this song a lot. At some point I'll have to learn more about composition, and the first thing I'll try is to make a replacement, my own Song of Guiding Light.

Next week I'll try to finish the concept art for the platforming section, since that really does need finishing!
0 Comments



Leave a Reply.

    Tweets by GameViola

    About

    This is a development blog for my own game project, "Viola".

    Picture

    Archives

    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018

    Categories

    All
    Art
    Design
    Music
    Programming
    Story
    Viola

    View my profile on LinkedIn

    RSS Feed

Site

Portfolio
About
​Contact
  • Home
  • Portfolio
    • Angela's Wedding Disaster
    • Angela's High School Reunion
    • Angela's Fashion Fever
    • Viola
    • Press Q To Stop Time
    • SECRET
  • Blog
  • About
  • Contact
  • Presskit