OUYA CREATE Update: Interfaces!

I spent today learning NGUI, a pretty awesome UI library for Unity. I’ve got health bars for players working, and a main menu screen in progress! I also created a thread on OUYAForum.com – it looks like some people are interested in the game!

Here’s a teaser photo of the prototype running on the OUYA:

WIP Hack n Slash OUYA photo

And as a bonus, here’s how the scene actually looks in Unity:

Unity3D scene view of Hack n Slash WIP prototype

The interface elements are on a different layer from the rest of the game, which means the main camera can’t see the UI, and the UI camera can’t see the rest of the game. However, the interface elements are still off to the side for the sake of simplicity/cleanliness. Implementing it was surprisingly painless with a combination of the NGUI tutorial videos and these nice videos by BurgZergArcade. My code ended up a bit different from the BZA tutorials, though. Here’s a code snippet from the health bars:

using UnityEngine;
using System.Collections;

public class HealthBar : MonoBehaviour
    private UISlider slider;

    void Awake()
        slider = GetComponent<UISlider>();

    public void UpdateDisplay(float percentHealth)
        slider.sliderValue = percentHealth;

Then, when the player takes damage, their script just calls healthBar.UpdateDisplay((float)playerHP / maxHP); to update the health bar. Easy!

Progress is looking good for CREATE!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s