Text101 Game in Unity3D

Post on 07-Aug-2015

58 views 6 download

Tags:

Transcript of Text101 Game in Unity3D

Introducing Text 101

What Text 101 Teaches

• Increase our scripting skills (nearly 200 lines!).

• The basics of “finite state machines”.

• Invite you to create and share your own story.

• Build our game to the web.

• Share with the world.

More About Creating New Projects

More About Creating New Projects

Recap how to create and save projects

Setup & save your Text 101 project

What gets “carried-over” to new projects

Import your prison image asset

Save your project

Carried-over to a new project

Your current layout (easy to reset)

Unity Preferences (e.g. play mode tint)

More About Creating New Projects

In this video…

Recap how to create and save projects

Setup & save your Text 101 project

What gets “carried-over”

Import your prison image asset

Save your project

More About Creating New Projects

Adding 2D User Interface Text

Lecture Summary

• Adding a UI > Text element to a scene

• Setting the camera background colour

• Moving and scaling your text

• How to programatically change text

• Challenge: Change text only on key press

• Challenge: Add and scale the image

Downloads Here

1

2

Download your files

Change text on key press

Use an if statement

Use Input.GetKeyDown

Text starts blank when game first runs

Change text to “key pressed” on key press

Challenge: Add and scale the image

Add an image to the UI canvas

Scale it to around 1/3 height of canvas

Centre it on the canvas

Ensure the background is transparent

Make sure the game runs

Adding 2D User Interface Text

Lecture Summary

• Adding a UI > Text element to a scene

• Setting the camera background colour

• Moving and scaling your text

• How to programatically change text

• Challenge: Change text only on key press

• Challenge: Add and scale the image

More Content Coming Soon

More Content Coming Soon

Why this section isn’t finished.

When we will be adding content.

What to do next

More Content Coming Soon

Why this section isn’t finished.

Lean production system.

We want your feedback.

Gets the content to you ASAP.

More Content Coming Soon

When we will be adding content

This Section Is In Progress

Time Zone Times

Greenwich Mean Time

Mon 3rd November11am to 5pm GMT

Tuesday 5th November11am to 5pm GMT

Pacific Standard Time

Mon 3rd November3 am to 9 am PST

Tuesday 5th November3 am to 9 am PST

What to do next

Save your scripts, scene and project.

Move on to the next section.

Come back once the section is finished.

More Content Coming Soon

Word Wrapping & Joining Strings

Lecture Summary

How to write long strings in C# code

How word wrapping works on UI Text

Building Your Game Engine

In This Lecture…

• The structure of our “engine”

• What’s an enum?

• Challenge: complete the story

The Structure Of Our “Engine”

• Update() keeps game in the right state.

• State methods: set text & respond to keys.

• One state method per state.

What’s an enum?

“The enum keyword is used to declare an

enumeration, a distinct type that consists of a set

of named constants called the enumerator list.”

http://msdn.microsoft.com/en-us/library/sbbt4032.aspx

Complete The Story

• Write all 8 state methods.

• Write your story text.

• Write the if statements to respond to keys.

• Test your game flow works.

Downloads Here

1

2

Download the code

Re-Organising Your Code

Update Your Update() Method

• Add the new states to States enum.

• Add new if statements to Update().

• Drop state_ prefix (Search > Replace).

• There is a better way, but not now.

Rename freedom to corridor_0

• Change the line in Update().

• Rename your state methods.

• Update your text.

• Update key press options.

• Anything else?

Extending Your Story

Add New State Methods

• Adding at the top may be easier.

• Have your GDD visible.

• Test your game.

Just Skim This Video

• Please create your own story.

• Just skim this video.

• Useful “code-folding” tips at around 11:20.

• Good luck!

Local Play Testing

• “4-eyes” principle.

• Remember to explore all branches.

• In my story: Return to cell => Roam call*.

* Thanks to Bobby, an early access backer.

Build For Web & Share

In this video…

• Encourage you to create your own story.

• How to build for the web.

• Test your build locally.

• Share using GameBucket.io or similar.

• Post to the course discussions & Facebook.

Some Ideas For Creation

• Tweak our text to make it read better.

• Make a whole new game, same structure.

• Make a whole new game, different structure.

• Translate the game to your native language.

• Add images if you want, but we’re covering later.

Web Player Build Settings

Player Settings…

• Default Screen Width = 800

• Default Screen Height = 600

• WebPlayer Template = Black Background

• If your text doesn’t fit, reduce font size

How To Share Your Game

• Copy the URL from www.GameBucket.io.

• Check in an anonymous / private browser.

• Post as a discussion against this lecture.

• Share on www.Facebook.com/UnityCourse

Unity 5 & Tweaks

In this video…

• Remove state logging (line 22).

Recap & What’s Next

Recap & What’s Next

• Did you write your own story?

• Go on, be brave!

• Maybe ask a friend to write it?

• Build for the web.

• Share in the Udemy Discussions, or

www.CompleteUnityDeveloper.com