Author: Mark
-
Angular Filters
Ways to format and sort your data, pretty cool. {{0.1 | currency : ‘£’ }} = £0.10 {{‘20150613T13:23:30′ | date:’dd/MM/yyyy @ h:mma’ }} = 13/06/2015 @ 1:23PM {{‘all caps’ | uppercase }} = ALL CAPS {{‘Really long text’ | limitTo:14 }} = Really long te <li ng-repeat=”product in store.products | orderBy:’-price’” > = orders the…
-
Demonfall Week 8 Progress
This week I completed the last demon and started testing on an Android device (pictured above). A lot of it is working quite well. I found a bunch of bugs including the expected one where you can’t tap on 2 buttons at the same time. So, I’ll have to redo the button code. Hopefully it’s…
-
Angular Basics
To start using Angular, attach it either locally or via CDN. There are 4 main elements in Angular: Directives, Modules, Controllers and Expressions. Directives There are HTML attributes (or elements) that call the module code. An example of this is: <html ng-app=”moduleName”> This is an attribute directive. You can also right your own element directive…
-
Demonfall Week 7 Progress
Failed to reach my goals from last week this time. I spent too much time trying to get a particle effect for the demon (featured in the screenshot). In the end I did some compromising and I’m happy with the result. (The particle effect was so quick I couldn’t even take a screenshot of it.)…
-
Demonfall Week 6 Progress
Pause menu appears when you press the pause button mid game. Animations added include the guy, lava and demon hand. Also 3 of the 5 demons are animated as well; featured is the demon spirit. What’s next: I’m starting to think I set up the buttons wrong. They might be listening for mouse clicks instead…
-
Reusable Move Function in Unity
Similar to the Fade Function, here’s the Move one: public IEnumerator move(GameObject obj,Vector2 targetPos, float speed = 1){ Vector2 startingPos = obj.transform.position; while(startingPos.x != targetPos.x || startingPos.y != targetPos.y){ Vector2 curPos = obj.transform.position; if(curPos == targetPos){ yield break; } obj.transform.position = Vector2.MoveTowards(curPos, targetPos, speed*Time.deltaTime); print (“moving “+curPos +” – “+targetPos ); yield return null; } } This function assumes you’re moving a game object from it’s current position to another. It’s parameters are the GameObject, the position it wants to move to and a speed that’s set to 1 by…
-
Reusable Fade Function for Unity
This is the function I use: public IEnumerator fade(GameObject obj,float fadeSpeed = -0.1f){ for (float f = obj.GetComponent<Renderer>().material.color.a; f <= 1 && f>=0; f += fadeSpeed) { Color c = obj.GetComponent<Renderer>().material.color; c.a = c.a + fadeSpeed; if(c.a <0){ c.a = 0; } if(c.a >1){ c.a = 1; } obj.GetComponent<Renderer>().material.color = c; yield return null; } } This function has 2 parameters: 1) the game object that’s to be faded and 2) the fade amount. By default it’s -0.1f which you can change. To use this function just use: StartCoroutine(fade(myGameObject)); StartCoroutine(fade(myGameObject,0.1f)); The…
-
Fielded Content Types in Drupal
Content types are like a custom type of page that also be used to sort other pages. In this example we’re making a destination content type and then allowing another page to select what destination that page belongs to. To make a content type, go to ‘Structure/Content Types’ and then the ‘Add content type’ button.…
-
Demonfall Week 5 Progress
I’m happy to say I got all the demon’s attacks working :) This includes the warnings, gradually stronger attacks and how it affects the player if they get hit. I’ve changed one of the demon’s effects from the original game because I felt it didn’t fit in with the others and feel much happier with…
-
Making a local Drupal site
I use MAMP to manage different sites. Also download Canvas which provides the installation files. Unzip the Canvas file and put the files somewhere on your computer. Open MAMP, go to the ‘Hosts’ tab and click the + button on the bottom left. Give a server name eg. canvas.localtest. Click the folder icon to the right of ‘Document…