Unity 3D Game Development by Example Beginner’s Guide: Game #2

A few months ago, I wrote a blog post on #AltDevBlogADay reviewing a Unity3D book written by Ryan Henson Creighton, Unity 3D Game Development by Example Beginner’s Guide (buy the book, it’s pretty good, so far), but I only gotten around to Chapter 4.

Unity 3D Game Development by Example Beginner's Guide

So for this blog post, I will go through some of the other chapters, particularly Chapter 5 and 6, which is about making a game called “Robot Repair”.

Chapter 5 will talk about GUI (graphical user interface, pronounced as “gooey”, like marshmallows). And we’ll be making an entire working 2D flip n’ match memory game in the GUI system.

So let’s get started!

First we open Unity and create a new project called “Robot Repair”, we don’t need to import Standard Assets, according to the boss (Mr. Author, Ryan Henson Creighton).

So we have an empty slate (este project).

A Unity scene is a big 3D world, but we would be ignoring that for now. We will be using the GUI layer, which is like “a sheet of glass” in front of our 3D world.

We will be making 2 scenes for this game. A scene is like a level or a screen in our game. So two scenes, one for the title and one for the game game.

(how organized are we)

So we are making the title screen first.

(tada!)

Of course, so far the TitleGUI script is still empty.

And we type some code (este copy paste from the book):

And we get this:

And if you clicked the button, you get a lil message:

(yeah)

The book came with some code files and assets for each chapter, packed as Unity packages, just double click on the file and it’ll import it to your project.

For the title screen, the author has prepared a cute image that we will add as a GUITexture, and so we get this:

(oh, we also changed the position of the button, so it’s front and well, not really center)

And then hook the button to some code that will bring us to the game:

Application.LoadLevel(“game”);

(yes, this short little code will bring us to the next scene, if we have our scenes added to our build settings)

Lalala… okay, time to make the actual game game.

We go to the game scene (just double click on the scene in the Project panel).

And we’ll make a GameScreen game object and a GameScript script (like what we did with the title screen).

Ooh… what codes will we fill this new script with? *copy paste some codes from the book* Okay, and read up on the explanations too.

And we get this!

(whee)

And then we are done with one chapter. Look at us, pretty good, huh.

Advertisements

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