Monday, March 4, 2013

Character selection AND MORE!

Right, a super productive weekend has resulted in some new mechanics! Apologies for lots of downloadable files in this post, but I don't have a website where I can post web player builds. :(

First up is a build with a working version of the selection mechanic, as outlined in the previous post.

Download HERE.

There's a (very placeholder-y) HUD in this build that allows the player to switch between Otis and Fawn as well as move the selected character around the level.

It took me FOREVER to figure out how to make this work; the GetGUIElementHitTest action I tried to use initially didn't do anything at all. In theory, it should have been able to tell if a left button mouse click had hit a GUI texture and fire an event... But no. I ended up having to place invisible buttons on top of the character icons; this worked much better.

When the player clicks either icon a state machine sends a message to a character switcher script that says "oi, this character is active now!", which then sends the same message through to the movement script.
This value is also read by ANOTHER state machine that handles the icon swap on the HUD. Phew.
I LOVE how Unity handles global/public variables and how you can make state machines and scripts talk to each other. So easy and accessible. Debugging the values is easy as pie too, since they're exposed in both the inspector and the state machines and change during runtime. Very tasty.
Known issues in this build:
The HUD textures are pixelated. I honestly have no idea why they're doing this - the alpha channel looks fine in Photoshop. I'll have to investigate. But this is a great time to introduce the QA tab in Hansoft! At this moment I only have one bug, but I expect this number to increase very very much as I go along.
There's also the lack of particle effect/audio/other feedback when a character is selected, but the important thing is that the trigger to add those things exists. The rest is polish (important polish, but polish nonetheless).

BUT THAT'S NOT ALL!

In THIS build the level has been zoned off to include this functionality:
So Fawn can't move to the top left cave, and Otis can't reach the bottom left cave. This is done by setting the bridges (splines) between the zones to be accessible by Fawn, Otis or both.
I realise that these floaty splines aren't the prettiest or most elegant solutions, but they'll have to do until I find the time to create some animations.

...BUT THAT'S NOT ALL EITHER!

With both characters moving around the level it was super easy to add a little distance check between them.
Download this build to see the light/dark change!


The ambient light colour is changed over a time of two seconds, as is the main light in the level and the colour of the fog.The skybox also changes, but in a very abrupt and horrible way since I don't think there is a way to make it fade to another. I'll have to get rid of the skyboxes and use planes instead, and hopefully there is some way to fade between textures to make it a little bit smoother.

Phew! Good progress, I'd say. Next I'll have to tackle the inventory and items in the level, as well as the cameras. It's becoming increasingly clear that the game will be quite unplayable with a static camera... The angle of the camera means that it's hard to click certain areas to move there, and that the candles on the wall along the bottom won't be visible and thus impossible to use. I'm thinking either a zoomed in camera that follows the selected character, or a solution that blends between different static cameras depending on where the selected character is. We'll see.

No comments:

Post a Comment