Skip to main content

Posts

Handling Music and Sound Effects In Your Games

Initiative  While developing Treva's Adventure I had to figure out a way to handle multiple music tracks and sound effects in a clean manner or suffer horribly.  What was going to help me achieve a simple solution was taking all the different sounds and centralizing them in a single class in order to black box them.   Any other code trying to play a sound wouldn't even know the sound file's name.   All code trying to play a music track would reference a enum that defines all the track names. Defining The Class Creating The Enum When I first started defining types in my enumeration,  I was naming the types to be exactly like the file name.  For a scary sound effect I had found a file named "ghost breath".  So around my code would be scattered lines like SoundManager.Play(SoundEffectType.GhostBreath);  This was fine until I found a sound that better fit the situation it was being used in,  and decided to use "ghost breath" for a different s
Recent posts

Clean up in GIMP

Some of you may think, "Dang, that's a clean looking tree."  And in fact, like this, it looks pretty clean. And some of you if you drew a tree like this would sign it off as done and ready for some game action.  However, if you take a closer look (About 200%) Oh wait, those colors are still inside the lines!  I guess it really is read- WAIT.  LOOK CLOSER.  (In other words, add a black background) Filthy, filthy tree.  Tree is not ready for the game.  So, now that you can see where all your little pesky errors are, you can whip that tree into shape Which means you need your handy dandy eraser. HOWEVER! Before we start erasing, we are first going to select the black outline and copy it, and for those who don't know how to do so, this is how: That is your magic wand, you want to select it. Then you click on the black outline (note: this is for if your outline and and colors are on the same layer, if they are not (e.g. your outline is

Creating 2D Animation For A Side Scroller In Unity3D

Update 3-13-14 Unity kinda released some really nice 2D tools, I really don't know how relevant or helpful this is now. I've been working on a 2D side scroller. Being my cheap self I'm not going to bother buying some helpful tool that would probably speed up everything a substantial amount, and created my own method of 2D animation for things in Unity3D. This code does not work with a sprite sheet, but I hope it makes it easy enough for you to incorporate one if you wanted to. Warnings:  The animation is displayed by updating the meshes material's texture each frame (this can mess up at high frame speeds). This code is assuming the 2D sprites are moving along the X and Y axis. When changing directions, it is scaling the transform negatively across it's x axis. Its assuming default direction facing is right. using UnityEngine; using System.Collections; public enum Directions{left,right} public class FlatCharacterAnimation : MonoBehaviour {

2D Level Visual (De)compisition and Preparing for a 2D Game

Alrighty you guys, I haven't been on in a while, as you can see with the massive delay between the Making Images in GIMP Part 2 and the to-be Making Images in GIMP Part 3, school has been piling on the projects and I can only work the video games during the slim slots of free time I have, so in order to keep from going completely off the map with blog posts, this will be a tipper in the composition of 2D game levels.

A Few Pointers On Switching From JavaScript To C#

One does not simply add to an array. In JavaScript you might have familiarity with using arrays. You might also be familiar with "adding" to arrays. Well Unity sugarcoated that for you. Arrays are not really re-sizable. When you declare an array in c#,  you have to define it right there. If your looking for something similar to re-sizable arrays, use lists. To use Lists in Unity c#, you must add the line " using System.Collections.Generic; " At the top of your code. Declaring a list of Game Objects would go something like this List<GameObject> myGameObjectList = new List<GameObject>(); Then adding to the list would is as simple as myGameObjectList.Add(gameObjectInstance); Then if you really just want an array you would say something like GameObject[] gameObjectArray = myGameObjectList.ToArray(); The API is not what it always seems. Unity has also sugar coated some of its API, some parts to the point where its practically lying to

Making Multiple Instances of Windows With Same Window Method

So when developing a small little web-player, I ran into the problem of trying to render multiple instances of the same window function. My plan was for my user interface component to iterate through all the thought components and for each thought, render its contents in a new window. The windows need to be draggable also. My first attempt of this implementation failed. Rect thoughtRect = new Rect(20, 20, 200, 100); void OnGUI(){ for (int i = 0; i < allthoughts.Length; i++){ thoughtRect = GUI.Window(0+i, thoughtRect, DoThoughtWindow, ""+allthoughts[i].GetContent()); } } void DoThoughtWindow(int windowID) { GUI.DragWindow (new Rect(0, 0, 10000, 10000)); } For those who don't see the problem with this, I'll explain. All three windows are using the same Rect  thoughtRect  so all the windows are drawn on top of eachother. You might think this won't pose a problem due to the windows being draggable, yo

Fixing Sketch Up blank window (white box) problem

When downgrading my OS over Christmas, I was faced with many problems, one of which is getting my Google sketch-up working. Almost everything was working perfectly, except one little thing, The 3D Warehouse. It was just displaying a blank screen . At first I thought I had blocked permissions for giving it internet access.  Though my computer said it was allowing it to go over the network. I tried turning off my firewall and still nothing happened. I don't have any anti-virus software so I didn't worry about that. Guess what fixed it this annoying problem? Updating INTERNET EXPLORER. Just check for updates, and updates for what ever you computers default browser is also. Now everything's back in harmony