Skip to content
January 7, 2014 / CoffeeCoder

What it looks like editing the game in Unity

Here’s a quick little video of what it looks like editing the game in Unity.

I have managed to implement a LOT since that video was shot last night.  I’ve worked out some more camera stuff, added different directions the camera can face, updated the scripts for the player and camera (though the player script still needs a LOT of improvement!), and basically I’ve done a lot except actually build a more playable game.  But work *is* going on!

Things I want to add:

  • Checkpoints
  • Traps and enemies
  • When the player collects all of the gems, a “Warp Gate” will appear, which is what will make the player physically go to the next level

I only work for four hours tomorrow, so we’ll see how much I actually get done!

January 6, 2014 / CoffeeCoder

Work on “Roll-A-Ball”

Over the last few days, I’ve been working on the “Roll-A-Ball” tutorial series from Unity’s website.  I’ve decided to create a new game based off of the example project the tutorial has you make.

Although I’ve kept the title “Roll-A-Ball” for now, it will be changed later.  I feel I’ve already changed the game in so many ways and have made it my own!

The plans for the game include something of the following…

  • The player must collect all of the gems in order to progress in the game
  • Some kind of enemies and traps will be introduced
  • There will be levels full of puzzles the player must solve in order to get some gems
  • Power-ups
  • Possibly a shooting element (keyword POSSIBLY; not sure how it would fit into the game to be honest, but it’s an idea nevertheless!)

Those are the plans so far.  I have implemented a lives system, and an automated camera system.  When the player goes around corners, the camera will rotate and position itself accordingly, in an effort to make it clear to the player that yes, that is the direction you need to go!

Here’s some screenshots showing some progress:


Although this version is outdated, you can experience some of the controls of the game for yourself on my new website at yodamanjer.com/games

December 27, 2013 / CoffeeCoder

Having WAY too much fun with Unity…

I am having a ridiculous amount of fun with Unity tonight.

First, I’ve been working on creating “elevators” (or just moving platforms) that move to specific targets, wait a few seconds, then travel back the way that they came.  It was great fun getting that to work!

I know it’s pretty simple stuff, but keep in mind that I hadn’t been programming in quite a while so had forgotten a lot about what I had learned in the past.  Now, though, I’ve learned so much more it’s kind of nuts.

This is the final script I wrote to control the elevators:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using UnityEngine;
using System.Collections;

public class MovingPlatform : MonoBehaviour 
{
	// Public variables
	public Vector3 origin;                // Origin point of platform (can be set in inspector)
	public Vector3 target;                // Target point of platform (can be set in inspector)
	public float speed;                   // Speed to move at (can be set in inspector)
	public float timeDelay;               // Time to rest before moving again (can be set in inspector)
	public bool  moveSwitch;

	// Private variables
	private bool moving;     	          // Determines if the platform is moving or not
	private Vector3 newTarget;            // Sets target of platform after it's reached its original target
	private float timeDelayBackup;        // Used to reset timeDelay
	private Transform myTransform = null; // Used to cache transform

	// Initialize variables
	void Start()
	{
		newTarget = target;                      // Sets the initial target to the one specified in the inspector
		timeDelayBackup = timeDelay;             // Backs-up the value of timeDelay so it can be reset
		moving = true;                           // Set moving to true (though the timer still counts down the first time the script is run)
		myTransform = GetComponent<Transform>(); // Caches transform in myTransform
		myTransform.position = origin;           // Sets position to origin point set in inspector
		moveSwitch = false;                      // Sets moveSwitch to false
	}

	// Use FixedUpdate to ensure accurate movement
	void FixedUpdate() 
	{
		// Only move if moveSwitch is true
		if (moveSwitch)
		{
	     	    // When elevator meets end position, reverse direction and set moving to false
			if (myTransform.position == target)
			{
				newTarget = origin;
				moving = false;
			}else if (myTransform.position == origin)
			{
				newTarget = target;
				moving = false;
			}

			// Reset timer when it hits 0f and set moving to true
			if (timeDelay <= 0f)
			{
				timeDelay = timeDelayBackup;
				moving = true;
			}

			// Move platform when moving is true
			if (moving)
			{
				myTransform.position = Vector3.MoveTowards(myTransform.position, newTarget, Time.fixedDeltaTime * speed);
			}else
			{
				// Begin countdown and halt movement
				timeDelay -= Time.fixedDeltaTime;
			}
		}
	}
}

As you can see, though, I didn’t stop there.  I created this variable called “moveSwitch”, which only moves the elevator when it’s set to true.  Which it’s not, so how did I do that?!

I created another object and named it “ElevatorSwitch”, then I gave it this script!

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class ElevatorSwitch : MonoBehaviour 
{
	// Declare variables
	public List<GameObject> movingPlatforms = new List<GameObject>(); // Stores assigned platforms (used in inspector)
	private MovingPlatform script;                                    // Used to grab the script component from each platform

	// Update Loop
	void Update()
	{
		//Flip switch between on and off
		if (Input.GetKeyDown(KeyCode.Q))
		{
			// Loop through each platform and flip the value of moveSwtich
			for(int i = 0; i < movingPlatforms.Count; i++)
			{
				script = movingPlatforms[i].GetComponent<MovingPlatform>();
				script.moveSwitch = !script.moveSwitch;
			}
		}
	}	
}

So once I had done that, all I had to do was assign each elevator to its slot in the list, and the script would iterate through the list for how many elevators I put in, and whenever I press the “Q” key, it toggles between on and off.  Wahlah!

The plan is to use these two basic ideas and create 2 prefabs – a switch and the elevator itself.  The idea is to be able to link certain groups of elevators to certain switches only – so for example, you can have a red group and a blue group, each with red and blue switches.  When you activate the blue switch, the blue group moves accordingly!  When you activate the red switch, the red group moves.  Really simple!

One way to take this further is to deactivate the other group of elevators when another group is activated, which would add a real puzzle element, wouldn’t it?  Perhaps that’s the evil plan!

December 22, 2013 / CoffeeCoder

Learning more about Unity (4.3)

Over the past few days, I’ve been watching a lot of scripting tutorials on Unity’s YouTube channel.  Since I had forgotten a lot about programming since the last I had touched it, I felt like it was a good idea for a quick refresher.

Somehow, I’ve managed to learn a lot more over the past two days than I had in the previous few years I had been studying programming.  I’ve learned more about Vectors, classes, and everyone’s favorite, math!  However, even with all of this progress, I’ve also realized I need a pretty big refresher in even basic algebra – I’ve forgotten such simple things as long division and basic multiplication, it’s a wonder I’m able to think on my own!

Aside from the programming, I’ve also learned more about how Unity works in general, like setting up different buttons for game input, using materials to create colors, lightmapping techniques, and various other little things (destroying components on an object, for example).

Hopefully, I’ll have learned enough to begin work on my NaGaCreMo ’14 project soon!  I’ve decided to do a remake of “Breakout”, only with lots of little twists and other fun things to make it quite different from the original!

I’m going to start posting weekly updates on the progress of my learning.  This will help keep me motivated to stay learning, and also help me keep track of everything I have learned so far!

December 3, 2013 / CoffeeCoder

NaGaCreMo 2014!

For NaGaCreMo this coming year, I’m going to produce one working level of Cuboidz.  However, instead of doing Cuboidz in 2D, I’ve decided upon a unique look that will hopefully give an interesting feel to the game!

Imagine, if you will, a side-scrolling platformer in 3D in which you can choose which angle you’re viewing it at.  One angle could be isometric, the other top-down, and yet another could even be first-person!  But here’s the kicker – you can only choose these views AFTER you’ve unlocked them by either “finding” it in a previous level, or hitting a certain amount of points.

Using Unity3D for this game will make that SO much easier – I can use the tagging function Unity has in order to “see” which view is currently activated, and by using a function in the player’s stats script I can easily determine which views the player currently possesses in their inventory, and thus which one is currently activated.

But it gets even more twisted-er  than that: after you select your view, and if it’s a particularly tricky view to play in, and you complete the level within a certain time using said view, you may obtain a certain reward!  Yay!

Of course, there will be levels where the camera is relatively fixed, so using different views will either be disabled in these cases, or you can only use a select few.  In some levels, you won’t be able to see certain secrets, unless you use certain views, so the aim of the game is to encourage experimentation, and exploration!

Amazing how an idea can evolve in a year, eh?

August 9, 2013 / CoffeeCoder

Bought an iMac Yesterday!

Yesterday, I decided to take a chance and plop down some cash on something I have always wanted.
For as long as I can remember (well, more like 6 years really), I’ve wanted an Apple computer.  I’ve always been a fan of Apple’s sense of design and style.

I finally bought myself a 27″ iMac computer, and I couldn’t be happier with it.  The main reasons I bought it are…

  • So that I can develop for Mac/iOS using Xcode and Unity3D
  • For video editing and other media related things (music, graphic design)
  • Gosh darn it, it’s just pretty!

    Minecraft runs pretty well on it, and it does everything I want it to!

    Yup.  Pretty happy camper here!

July 23, 2013 / CoffeeCoder

Definitely just signed up for online classes!

“I like this ship! It’s exciting!”

I have finally bitten the bullet, and enrolled myself in the classes available at GameInstitute.com, which despite some negative reviews has an INCREDIBLY cheap price tag and a lot of available content. They have an excellent course on C++ (which is what I’m taking first, as every other learning module requires it), art, animation, electronics and mathematics, and even a new section dedicated to Unity specifically! It’s fantastic!

Right now, I’m waiting for Visual Studio 2012 Express to install, so that I can actually start the classes. Luckily, they’re all designed to be an “at your own pace” thing, which is incredibly convenient to me.

Another site that will help in the mathematics department is KhanAcademy.org, and I can’t wait to get started on that as well! Definitely need to re-learn a lot of algebra and geometry, since I haven’t really used that in… well, ever, because normally my games I’ve made haven’t gotten far enough to require uber-mathematics. I normally did things the lazy way!

Anyways, I’m excited for this! This will definitely help me in my quest for learning game design!

July 23, 2013 / CoffeeCoder

Unity 4.2 is amazing!

This is why I love Unity, everyone!

4.2 was released yesterday, and among many bug fixes and improvements, the people over at Unity decided to make publishing to all mobile platforms FREE! That means I can make an Android game for free instead of having to buy the package for it now!

Aside from that, they also made realtime shadows available in the free version (but only with Directional Lighting, which is fine). This is great, because it will visually improve a LOT of my ideas!

As for the game I want to make for Android, I still haven’t come up with anything. I was thinking perhaps a 3D remake of something, but I’m not sure what I would do. I suppose I could do a version of Breakout where you use the phone’s gyroscope to move the paddle, but that seems annoying… hmm. I shall see what I can come up with!

July 21, 2013 / CoffeeCoder

Android!

This is my first post from the WordPress android app!

I recently purchased for myself the Samsung Galaxy S4, and it has proved just how much gaming power a mobile device can have in this day and age! The graphics are similar to the 360, and the games themselves run really well. If you have this phone, look up “Epic Citadel”  in the Play store. You won’t be disappointed!

In fact, this phone is so powerful I’ve decided to attempt my first Android app/game. I  just have to learn how to do some stuff with Unity3D, like gain access to the gyroscope in a phone, but I will get it done somehow!

July 10, 2013 / CoffeeCoder

I’m not dead!

Hi everyone, sorry for lack of updates!

I am very much alive and have just been swamped with lots of activities.  Joined a gym with my girlfriend a few weeks ago and have been going 2-3 or even 4 times a week, and my work schedule has been all over the darned place, too, which means I’ve had a lot less time to work on any development for my Awesome Project of Awesome™, which I will work on more on Sunday since that’s my next day off.  I have been working on some notes for characters, basic design elements and the like, but I’ve got nothing uploaded yet!

I think I’ve said this, but the game will be made using Unity3D, so that I can utilize a TON of great assets, like NGUI, 2D Toolkit and many other things!

However, I am not proficient in Unity just yet, so I have to take a lot of courses to get decent at it!  This will take some time but be so worth it in the end!