Wednesday, August 27, 2014

One man's trash is a headache to program

Hi folks! This is my second post on the game Dog's Day. I have been pouring over tutorials, UnityScript API and junk posts about Objects and Classes. The end result is a well crafted and scalable inventory system.

Woooooooooooooow this was a weird one.

So in Unity you don't just add an array for inventory. No, it can't be that simple. Screw you. How Dare You Assume it! But seriously, it's a little tricky to get this concept. So the inventory must live somewhere. I chose to tag it on the player object (just like I did with sticking the game controls to the HUD object.) This works well for me. I found an inventory system to model after in THIS POST, but found lots of bugs. I tore out a few chunks I could use and scrapped the rest. I won't bother salvaging the GIU, but the basic item class was useful.

Then cam time for adding items. Again, I ran into a slight headache conferencing between scripts. It's something to get used to I guess. Write a script, then write another script, then make a variable by the name of the first script, then in unity, drag the script over, then in the latter script, reference it by another name.

sigh.

Not a big deal, but it feels clunky and foreign. All said, I spent a whole night hammering the keys and, 123 lines of code later, came up with a cool inventory script that updates the HUD, cycles items, and can add them; I also created a loot prefab that can be reused as any item to be picked up.

This may seem like a whiny rant but I can assure all that this is no less than a leap forward toward a completed game. I still need an artist (and lots of artwork) and several game mechanics, but hell, there's almost something to do in this game! Haha!

Until Next time,
Cheers!
mmmmm cheap beer

Tuesday, August 19, 2014

Dogs Day Log 8.19.2014

8-19-14
Today marks the first day about a blog about an adventure.
First log. Been working on this a few days. Noticed that world coords and screen coords are very
different. Makes me yearn for java programming. Oh well. I programmed a scalar tracking script in case I need to use it later.
Gonna have to reconsider how the artwork looks. Dumb down details, focus on building generic animations all human sprites will have access to. This will allow crowds and individuals to all have reusable movements.
Today's work includes building a test HUD that dynamicly displays all the hobo's stats. This was a bit weird in Unity. Not intuitive at all. I used public functions instead of static as most have suggested. Also the line "var GameControl : GameControl;" seems alien. Again, missing Java.
A quick word on instantiating variables: when you want to start a new object in Unity you define the variable name, then use a colon ":" and the type, rather than the type followed by variable name then possibly equals "=" and value. JS+Unity...not a fan. Oh well.
Oh, also, mono script's auto correct has pissed me off for the last time.