To add sound/music add the ‘Audio Source’ component to an object. Put your sound files in the ‘Resources’ folder ideally in it’s own folder called maybe ‘sounds’. You can drag a sound file into the ‘AudioClip’ area and tick ‘Play … Continue reading

Basically this is big black box to fade in and out over everything else to transition between screens. First I made a UI Image that is the same width as the canvas and then stretched it’s height to fill the … Continue reading

The tutorial levels are done… I guess. I kept it simple and didn’t literally tell the player how to play the game except for the goal of the game. I did give hints in the form of flashing buttons indicting … Continue reading

Paste this code into a new script called ‘CoroutineUtil’. using UnityEngine; using System.Collections; public static class CoroutineUtil {     public static IEnumerator WaitForRealSeconds(float time)     {         float start = Time.realtimeSinceStartup;         while (Time.realtimeSinceStartup < start + time)         {             yield return null;         }     } } What this class does is expand on the delaying code method by making it work even when the … Continue reading

This week, I made the high scores work including star ratings as shown in the screenshot. I’ve also done the logic and visual cues for completing the tutorial levels. I’ve also updated the Demon Spirit tutorial level so it flows better … Continue reading

@mixin rotate($deg,$ox:50%,$oy:50%){ -ms-transform: rotate($deg); /* IE 9 */     -ms-transform-origin: $ox $oy; /* IE 9 */     -webkit-transform: rotate($deg); /* Chrome, Safari, Opera */     -webkit-transform-origin: $ox $oy; /* Chrome, Safari, Opera */     transform: rotate($deg); … Continue reading

The little things from last week’s checklist are done. This week is all about the start menu and the screen shot is the section with the most content: the demon select screen. The screens are pretty much finished, it’s nothing … Continue reading

First we have our JSON file so like: [{     “name”: “Azurite”,     “price”: 2.95,     “canPurchase”: true }, {     “name”: “Bloodstone”,     “price”: 5.95,     “canPurchase”: true }, {     “name”: “Zircon”,     “price”: 3.95,     “canPurchase”: false … Continue reading

What custom directives let you do is package a whole lot of functionality and display it in just 1 line. Here is an example of making a custom directive in the js: app.directive(“projectDescription”,function(){         return{             restrict:’E’, … Continue reading

Touches in Unity

Featured

In this example, there is a left and right button that moves the character in that direction. Both buttons have a box collider. leftBox = GameObject.Find (“leftButton”).GetComponent<BoxCollider2D> (); rightBox = GameObject.Find (“rightButton”).GetComponent<BoxCollider2D> (); void Update () { foreach (var touch in Input.touches) {             if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled) {                 Vector2 wp = Camera.main.ScreenToWorldPoint (touch.position);                 Vector2 touchPos = new Vector2 (wp.x, wp.y);                         if (leftBox == Physics2D.OverlapPoint (touchPos)) {                         //do stuff                     }                     if (rightBox == Physics2D.OverlapPoint (touchPos)) {                         //do stuff                 }             } … Continue reading