Author: Mark
-
Demonfall Week 15 Progress
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 them to tap them. Hopefully it’s easy enough for the player to understand – only…
-
Wait for Real Seconds class using static function in Unity
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 game is paused. The function is made static so that any other script can access…
-
Demonfall Week 14 Progress
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 and also so the only way to beat it is to understand the mechanics of…
-
Rotate and scale mixin
@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); transform-origin: $ox $oy; } The default of the point of rotation is set…
-
Demonfall Week 13 Progress
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 flashy but gets the job done I think. I still have to link the high…
-
Loading JSON in Angular
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 }] To use it, instead of app.controller(‘basicController’, function(){ this.products = gems; }); where…
-
Custom Directives in Angular
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’, templateUrl:’projectDescription.html’, controller:function(){ this.projects = projectsVar;…
-
Touches in Unity
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 } } } } Basically, we check each touch, convert it to world space and then check…
-
Styling tables with CSS
This is how you replicate cellspacing and cellpadding with CSS. table.css { width:50%; display: table; border-collapse: separate; border-spacing: 20px; border:1px black solid; } .css td{ border:1px green solid; padding:10px; } View the demo Download the demo
-
Forms in Angular
Most of the code is in the HTML. Here are the main points: On the ‘form’ element itself add ‘novalidate’ attribute to turn off the default validation that some browsers have, have a name, as well as ‘ng-submit=”formName.$valid && Ctrl.submitFunction()”. The last bit does the submit function (not the submit button), checks if the form…