Skip to main content

Posts

Showing posts from 2011

How To Make A Gun Shot Sound (SFX On Unity 3D)

When it comes to audio in Unity, there are four components: Audio Clip , Audio Source , Audio Listener , and Audio Re-verb Zone . Audio Clips are the actual audio file imported into your game. Unity supports file formats: .aif, .wav, .mp3, and .ogg. When imported, you can compress them greatly, with the price of loosing some quality. You can do this by first selecting the audio clip, view it in the inspector. Under the Audio Importer component, you can switch the audio format from Native to the audio clip, to a compressed format applied by Unity. You can change how compressed the file is by dragging the bar at the bottom, then hitting apply. You can get plenty of free good SFX from a site called  freesound.org . All you have to do is create an account for free , and download all the sounds you want. I found a nice gun shot sound here . Simply download and load into your Project. Audio Source actually plays the audio clip in your scene. They are an component, so it mu

making a gun- blender 2.57

Blender obviously gives you all the tools you need to make a gun, so this shall be a tutorial on how to make one

How To Sync Up Unity Projects

Want to work on the same Unity Project over multiple computers? Even have multiple people work on one project all at once? Well theirs a free easy method that works! Step 1: Go to dropbox.com . Make an account and download their soft ware. You have 2GB of space for free! It's not much to expand on that either, but I've yet to run across any space issues. Step 2: Open up Unity. Go to file>New Project. Under project location, Browse, and create a new folder under your dropbox folder. Make that where your project lies. Step 3: Go share! You can install dropbox at any computer and log in with your account. Your assets will be loaded into the dropbox folder. To open you Unity project from dropbox, simply go to file>open project, then find the folder that contains your unity project and hit open. You can also log into your dropbox account, and send other drop box users an invitation to share your folder, you have to know their email. When they accept their drop box

Making A Laser Pointer

Want a frieking lazer pointer? BOOM. Attach a Line Renderer component to the object you have the script below attached to. (Component> Miscellaneous>Line Renderer) Code: function Update () { var lineRenderer : LineRenderer = GetComponent(LineRenderer); lineRenderer.useWorldSpace = false; lineRenderer.SetVertexCount(2); var hit : RaycastHit; Physics.Raycast(transform.position,transform.forward,hit); if(hit.collider){ lineRenderer.SetPosition(1,Vector3(0,0,hit.distance)); } else{ lineRenderer.SetPosition(1,Vector3(0,0,5000)); } } @script RequireComponent(LineRenderer) Thank  3dDude for the script. Original Source here .

Limiting Rotation of an Object

I made this script for my Beach Defender Game . It was to keep the player from rotating more than I want his to, because I'm a mean person like that. Any way it took me awhile to figure out how to not make them turn to far to the left, right, up, down.. You know. Here's the script. Pretty simple. Put under Update function. Feel free to suggest different ways. Or ask any questions. var upDown = Input.GetAxis("Vertical") *Time.deltaTime * (rotateSpeed-10); var leftRight = Input.GetAxis("Horizontal") * Time.deltaTime * (rotateSpeed-10); //making it turn up or down if(transform.localEulerAngles.x < 25 ){ transform.Rotate(upDown, 0, 0); } else if (transform.localEulerAngles.x > 295){ transform.Rotate(upDown, 0, 0); } //making it turn left or right if(transform.localEulerAngles.y < 65 ){

Simple Reload Script

Sooo I'm working on a simple Top Down Shooter game. And This was the script I came up with for the reloading part of the script. Very simple. I think you can use it with any weapon really. You reload with space. You  need to put your own method of Firing in this script. Comment if you have any questions private var reloading = false; var reloadTime = 2.0; private var st : int; var clipAmmo = 50; var clipSize = 50; var stockAmmo = 100; function Update () { if (Input.GetKeyDown ("space")){ if(clipAmmo<clipSize && reloading == false && stockAmmo !=0){ SaveTime(Time.time); reloading = true; } } if(st < Time.time && reloading == true){ Reload(); } } //Making it show that you are reloading. function OnGUI(){ if(reloading == true){ GUI.Box(Rect(250,200,100,25),"Reloading"); } } function Reload(){ if(clipAmmo < clipSize){ var neededAmmo = clipSize-clipAmmo; if(stockA

Top Down Shooter (Object Look At Mouse)

Sooo let's say your making a top down shooter, you want your player to look in the direction of your mouse like so: (Yeah I know, not the best picture)

Beach Defender

Just uploaded the game I've been working on for the past 2 months on Kongregate. Pretty awesome. I have been working on and off on it for a while and now I can get back to posting on this blog. Play the game here !

GIMP logo tutorial - Applying textures

This tutorial will be one of applying textures in the process of making the logo for game we are about to publish as a webplayer.  I will be using GIMP , a free download art interface.  GIMP is also pressure sensitive if you have a pen tablet, allowing a large range of detail.

Cloth Effect with Blender 2.57

When making a game with a character, you don't want that character to be clothe-less (right?)  So what you need are some cloth with a cloth effect, you don't want your character to look like a lego, do you? (do you?)  So here's a tutorial on how to apply the cloth texture to your object using Blender 2.57.

Adding Inaccuracy To Shooting

Let's say you have a shooter game and its just plain to hard. Your Enemies are perfect shots and can hit you straight on every time. Making the game a little more fair would be nice, and one way doing so is by dumbing down your enemies AI a bit, and making them a less accurate with aiming.

Blender Normals

In the previous post, in order to fix the model, I had to switch the normals.  Understanding what a normal is helps you understand how to fix future problems you may have with your model.  So, what is a normal?

Debug Rays =D

I use them for looking at what enemies are looking or aiming at. Since it's Debug it only shows up in the scene view and not in your actual game play. They  can be very useful sometimes. Here's an example of what they look like. The red lines are the debug rays.

Exporting Blender models to Unity 3D

Your models won't be much use unless you can export them to Unity.  This will be a continuation to the previous post, so overall this is the model making, exporting, and debugging process.

PT Boat overview

This will just be a brief overview on how I made this patrol torpedo boat for the game.  There won't really be any other pictures, just steps and tips.

Loading Project Assets Through A Script (dynamically)

To do so, you first need to start by creating a new folder and naming it "Resources" You put whatever you want to load in the script in the folder, textures, prefabs, all that stuff. So if you want to Instantiate a prefab, you would simply put this in the code. var boat : GameObject = (Resources.Load("Boat")); Instantiate(boat, location, rotation); Simple right? If you want to get something out of a folder in the resources folder you just say: var smallBoat : GameObject = (Resources.Load("folder name/Small Boat")); Ta da. Easy. Read more at Unity's scripting Reference here

How To Make Your Game Cartoon Like

Making your game have out lines like Legend Of Zelda , The Wind Waker, or any other cartoon like game, is easy to achieve. Just with any material you use in your game objects, you set its type to Toon . Like below

Coloring Icons Using Fuzy Select (Magic Tool) [GIMP 2.6]

Okay, so this will be the second way to do icons , and this method requires much less layers.  We will be using the fuzzy select, and if you don't know how to use it, then I hope this helps. 

Icons Using GIMP 2.6

In this tutorial,  I'll be switching from 3D modeling and such to 2 dimensional aspects such as icons which alone can make a game seem more appealing and also more interesting.  I'll be using GIMP 2.6, a completely free photo manipulation and drawing software.  You can download here .  GIMP comes in many different languages, which makes it so awesome.   Okay, on to the icons!

Google Sketch Up

It's free. Ha ha. Link to download is here . It's a 3-D modeling software. Pretty cool. But like most 3-D software you need to find a guide to learn how it works. Google already has plenty of nice tutorial videos. Within an hour a knew enough to get started. It's very simple and easy to learn. A link to the list of tutorials  here . There models work with Unity. You have to export them as a 3D model. Default file format is the extension .dae. Heres something I came up with in 5 minutes playing around with:

Question about a component?

There is alot in Unity to learn. So the makers of Unity decided to be awesome and put full explanations of what each component does. When ever your in question of what something does. Just click the question mark in the top right corned of the component in the inspector pane.

Where To Host Your Unity 3D Game

Since I've been busy with a new game and other stuff I haven't bothered much to explain stuff. Been trying to learn some more but haven't quite gotten anything useful yet. Anyway, if you have a ready webplayer game you want people to play but you don't know where to host it, Kongregate is a nice place.

Creating Characters (Blender 2.57) [Version 2]

Second way to make characters, this time a little more complex.  This will involve using child/parent relationships.  I'm not going to go into much detail, for more information, read previous posts.

Blender 2.57 exporting :D

We worked out the bug with Blender 2.57 and exporting. I'm going to go ahead and show you how to export. So, go ahead and once you're finished creating you're object, go into object mode, and select the entire object . Got that done?  Okay now go to file and to export, and if you're exporting to Unity 3d, select the .fbx autodesk file, and just save.  You can then open up the object in unity. Please accept my apology for unintentionally misleading you about Blender 2.57 importing/exporting abilities.  I will be going back to 2.57 tutorials, however, if you would like me to also do 2.49 tutorials, email the blog and I will strive be diverse in the Blender program interfaces.

Blender 2.49, setting up

Okay, so I have just now installed Blender 2.49, and I have to say, though it looks similar to 2.57, I'm having a hard time navigating around.  I'll do my best to help those who've also taken the liberty to download 2.49, and also I'll try to coordinate it so it's easy for those still using 2.57.

Blender

Due to importing/exporting problems with Blender 2.57b 64bit(stable version) between Unity3d, I will be switching to an older version of Blender, Blender 2.49, which apparently cooperates with Unity.  As far as tutorials goes, I will be trying my best to make sure that everything is coordinated correctly as far as using functions, modifiers, meshes, texts, objects, etc.  If you are also having problems with Blender 2.57 and would also like to install Blender 2.49, I will provide a link here   (http://download.blender.org/release/)

'Building' Your Game

**A brief overlook** Unless your games only going to be made up of 1 scene, your going to need to mess with your build settings. Start with going to: File>Build Settings... or by pressing Ctrl+Shift+B Scenes In Build contains all the scene that will be made in the game when you click build. The number next to the scene name is how you would reference in the script. Platform window contains all the platforms you can build for. XBox360 and PS3 need contracts though. I don't know how to obtain those. The default platform when you start a new project is PC and Mac Standalone.

Released our first game XD

It's pretty pathetic. But it's on Kongregate.com. links here . A screen shot:

Making music.

Well. I found a nice little site that will let you create your own music for free. Then download the music file to your computer. Not a cent. Unfortuantly everything I make sounds all techno XD But it can be useful. There editor looks like this. You don't even have to download it. It just loads right in your browser Here's the link

Unity's Available Prefabs.

Unity has on their site free packages and extentions you can download and get amazing prefabs. Such as this explosion prefab.

Collision/Trigger

An overview of how to use OnCollision and OnTrigger functions. Which almost all games have. Ha..

Child-parent relationship in Blender 2.57

Child-parent relationship is a confusing concept to understand and master, but important at that.  What a child-parent relationship is is that it "links" thing together without joining the objects into one.  This is good for when you have such things like humanoids when you want a singular part to move, but the entire creation.  (ex: parent: torso; child: arm; whatever the arm does will not affect the torso, however, if the torso rotates, the arm will rotate with it)

Building a landscape Blender 2.57

Landscapes are useful, and building one can be difficult  This will just be a simple how to on making landscapes

Materials and Textures Blender 2.57

Adding materials and textures is an important aspect of creating models and characters.  I'm sure that some of you  (like myself) add a texture to a model and it didn't apply.  This will be me showing you how to add textures and designs to objects.

Tags ^.^

Small Tip... Something that has been helpful to me is tags. What you do is set a game objects tag to something specific, to access them easier in a script. To set a tag, simply select the game object and in the inspector pane, click and select =D that easy.

Text to Mesh Blender 2.57

Most people who use Blender use it for game development (as this is how we are using it)  and many game developers may not just want flat text as their logo.  This will be a tutorial on how to convert regular text to a three-dimensional mesh.  (I would recommend reading my blog about hot keys if you are new to Blender here )

How to Instantiate!

When you instantiate something, you clone it, put it in the position you want, and the rotation you want. A very simple command. Done like this: function Update(){     Instantiate(transform, transform.position, transform.rotation); } So basically what this script does is clones what ever the script is attached to at the position of the object, and its rotation. Not really the best thing. Better yet it's in the Update function, which is being called every frame thats rendered, so thats allot of clones ha..

Don't Destroy On Load..

So if you want to keep an object or script that keeps up variables (or for any other reason) when you go from scene to scene, you need to attach a don't destroy on load static function, which goes something like this: function Awake () {     DontDestroyOnLoad (transform.gameObject); } The Awake function is call only once, when all the objects in the scene have been created. Read more about it here . DontDestroyOnLoad  has what ever is in the ( ) to not be destroyed when creating a new scene. (transform.gameObject) is what will not be destroyed when the new scene is loaded, in this case, it will be the game object and all it's children the script is attached to.

Blender Hot keys and Using Blender

This will show you how to use Blender and also the hot keys.Hot keys are very important (and simple) in Blender.  They make navigation, distortion, editing, toggling, and other things much easier than if you were to search for each individual function on the software.  I'm going to go over most of the hot keys and their functions.  (This is for Blender 2.57, hot keys and functions listed below may not work/coordinate correctly with older or newer versions of Blender)

Creating Characters (Blender 2.57)

One of the (if not the ) most important aspects of a game is the characters.  But another thing about characters is that they're hard to make.  This will just be a quick tutorial on how to make characters

Referencing another script..

So, here's how it's done. function addingExp(){     var level = gameObject.Find("Player").GetComponent(Level);     level.experience +=50; } Explanation: gameObject.Find("Player")  Finds the object the script it attached to. Player is the name of the object, note that the name has to be in quotations. GetComponent(Level) Finds the name of the script. level.experience +=50; level is calling the variable that we just set above, experience is a variable within the script that were calling on in the code.

What Is A Float And Integer?

Float is short for floating point which is a decimal value (example: var three : float = 3.14. An int (integer) is a number without decimal (example: var three : int = 3. Basically they are the two user variables used together with calculations. Basic text is called a string which is set by quotations (example: var three = "3". To convert between them you can use: numberVariable.ToString() parseInt(stringOrFloatToIntVariable) Mathf.RoundToInt(floatToIntVariable) <- (this one has lots of options) Special Thanks to save

Making your materials A little more realistic.. (Normal Maps and Bumped Diffuse)

How to go from this: To this:

GUI Basics

So every game has some type GUI (graphic user interface). The best way (as I see it) is scripting the GUI. Very simple, so something easy to start with: function OnGUI(){ GUI.Box(Rect(10, 10, 90, 90), "Hello!"); } Rect - Shape the box will be, rectangle. (10, 10, 80, 90) 10 - How far away it begins from the left of the screen. 10 - How far away it begins from the top of the screen. 80 - Total width of rectangle. 90 - Total height of rectangle. "Hello!" - Text that shows up in the box.

Input Character Controls?

When creating controls for your players to use, It's needed (or really just helpful) that you modify your Input settings.

Let there be fire =D

Creating a mediocre fire effect on Unity 3D . Start by clicking create>Particle System under the Hierarchy Pane.

Making Classes..

A dip into JavaScript. Before I begin. var is a variable. You need to declare your variables before you start writing code so the code will execute properly. Declaring a function goes like this: function Update(){ //Insert your code here.... }

First Blog...

Well, its going to be about creating games on Unity . I am relatively new to the interface and JavaScript. But I have gotten used to it through great tutorials and scripting references . I am going to be developing a simple (or at least at first.) video game, and keeping track of it on this blog here. Unless your at least relatively familial with Unity, you might want to watch all the tutorials (Yes I know its alot) to understand exactly what I am talking about.