RSS

Developer Diary #4

26 Feb

Implementation Week

This week I didn’t cover any new material from the text but instead took the time to implement fix bugs, implement planned features, and tweak things here and there. Although there is no planned learning material for implementation weeks I learn a lot of things by just trying to do them. Not every little thing I want to do will be found in a textbook so when I am trying to add new features and don’t know where to start I generally look to the excellent Unity Community page Unity Answers or the Unity script documentation.

Implementation Changelog

  • Added coin rankings to the main menu
  • Added all the code to update and save ranking information and display them on the main menu via bronze, silver, and gold coins
  • Added a spell counter to the main level GUI that tells you which ranking you are currently earning based on the number of spells you have cast
  • Added score display to the victory menu. It shows you the score you earned this round as well as what your best all time score is
  • Finished implementing the unlocking levels functionality
  • Moved pause button to the bottom right and put spell counter in the top right
  • Moved the “swings” down to make the level “the swingset” easier to beat
  • Fixed bugs introduced by changing the water colliders
  • Added a clear data button on the main menu
    • So I can erase level unlocks and ranks (mostly for testing)
    • This will likely later be put into a settings page
    • Added several levels and modified a few existing ones
    • Added several “cave” assets for second world
    • Made a sample cave level
    • Added parallax effect to forest levels
      • This includes a new layer in between the foreground and the background that scrolls at a different speed
      • The background also scrolls
      • Added few changes and optimizations to fix graphical and physics glitches on lower end device (droid x)
      • Implemented Journal Entries
        • Journal buttons work
        • Created journal controller persistent gameObject
        • Created one scene for all the journal entries (the text is changed dependent on the button pushed)
        • The first time you beat each “boss level” the next journal entry is forced when you say next level
        • When you start the game with no data you are given the first journal entry

Main Challenges

Cave Assets

The tile sheet I’m using for the cave levels is very confusing. It has many tiles of different sizes and they are not broken up on the tile-sheet. Furthermore it’s unclear which tiles are seamless and which ones can flow into each other aside from the ones adjacent on the tile-sheet and the ones in the sample pictures that came with it. I had to play with it a lot and hand-pick which images I wanted to use for the levels. I also had to edit a few of the images in order to fit my needs.

The other challenge was once I had them in unity I had to create custom polygon colliders for each image because they are not square. It’s important to be careful how you make the colliders so that each one flows seamlessly into the next.

Finally I had to play with the colors a bit to make it look right. The solid color below the foreground is slightly different from the black color that fills the background.

Journals

When implementing the journal entries I wanted to avoid making an individual scene for each entry because they would all be identical except for the text. The problem is that in Unity when you load a scene you can’t pass a parameter to it so I couldn’t say “when journal2Btn is pressed pass a certain string to the scene.

My solution was to create a gameObject in the first scene of the game that does not destroy when a new scene is loaded. This means it’s in every scene of the game and doesn’t change its data. Now when I button is pressed I set an integer value in that object which tells the journal scene which string to load.

The next challenge was to design my own scrolling algorithm to read the text as one does not exist for the textMesh solution I use. I created a scroller object that moves its y coordinate based on mouse movements when the mouse is clicked (this works for touches too). Then I used a standard “smoothFollow” script that comes with unity to have the camera follow the scroller object. I got the dimensions of the textMesh and used them to set a min and max to the scroller object so that you couldn’t go too far. When the scroller goes past the end of the text or the beginning it is pulled back at a variable rate depending on the distance. This gives a spring/bounce effect.

Advertisements
 
Leave a comment

Posted by on February 26, 2013 in Developer Diary

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: