Page 1 of 1

What do you do when you pass a level?

Posted: Wed Mar 10, 2010 1:04 pm
by jmobijo
I passed a level, but now what?

Re: What do you do when you pass a level?

Posted: Wed Mar 10, 2010 4:43 pm
by zander
This is perfect! From a developer's point of view, it seems obvious to click on your stats button to distribute your level up point :roll:
I guess I assumed you could read my mind!
I'll find a way to make it obvious what you have to do. (either a dialog box to pop up, or a have the stats button flash for a few seconds...)

Re: What do you do when you pass a level?

Posted: Thu Mar 11, 2010 1:17 am
by zander
I fixed it by having your stats button blink after you a pass a level, similar to when your Journal button blinks when getting a quest.
If you're curious, here's the code that I cooked up to make it work:

Code: Select all

using System;
using System.Collections.Generic;
using System.Text;

public class BlinkButtonManager
{
    // List containing all blinking buttons:
    private List<BlinkData> m_BlinkingButtons = new List<BlinkData>();
    public void BlinkButton(string buttonName)
    {
        BlinkData blinkData = new BlinkData(buttonName);
        this.m_BlinkingButtons.Add(blinkData);
    }
    // Every frame, this function will be called to update any blinking buttons:
    public void Update(float elapsedTime)
    {
        // I count backwards because I'm modifying the size of list while iterating:
        for (int i = this.m_BlinkingButtons.Count - 1; i >= 0; i--)
        {
            if (this.m_BlinkingButtons[i].m_IsJournalBlinking)
            {
                this.m_BlinkingButtons[i].m_JournalElapsedTime += elapsedTime;
                this.m_BlinkingButtons[i].m_JournalElapsedTimeIncrement += elapsedTime;
                if (this.m_BlinkingButtons[i].m_JournalElapsedTime > 1.5)
                {
                    this.m_BlinkingButtons[i].m_IsJournalBlinking = false;
                }
                if (this.m_BlinkingButtons[i].m_JournalElapsedTimeIncrement > .15)
                {
                    this.m_BlinkingButtons[i].m_JournalElapsedTimeIncrement = 0.0f;
                    if (TerraAegrus.Buttons[this.m_BlinkingButtons[i].m_ButtonName].ButtonState == GenericButton.STATE.IsRollOver)
                    {
                        TerraAegrus.Buttons[this.m_BlinkingButtons[i].m_ButtonName].ButtonState = GenericButton.STATE.IsPressed;
                    }
                    else
                    {
                        TerraAegrus.Buttons[this.m_BlinkingButtons[i].m_ButtonName].ButtonState = GenericButton.STATE.IsRollOver;
                    }
                }
            }
            else
            {
                TerraAegrus.Buttons[this.m_BlinkingButtons[i].m_ButtonName].ButtonState = GenericButton.STATE.IsUnpressed;
                this.m_BlinkingButtons.RemoveAt(i);
            }
        }
    }
    // Private data class containing information on a blinking button:
    private class BlinkData
    {
        public bool m_IsJournalBlinking = false;
        public float m_JournalElapsedTime = 0.0f;
        public float m_JournalElapsedTimeIncrement = 0.0f;
        public string m_ButtonName;
        public BlinkData(string buttonToBlink)
        {
            this.m_IsJournalBlinking = true;
            this.m_JournalElapsedTime = 0.0f;
            this.m_JournalElapsedTimeIncrement = 0.0f;
            this.m_ButtonName = buttonToBlink;
            // I don't like doing this, but it works:
            TerraAegrus.Buttons[buttonToBlink].ButtonState = GenericButton.STATE.IsRollOver;
        }
    };
}
 

Re: What do you do when you pass a level?

Posted: Fri Mar 12, 2010 1:12 pm
by jmobijo
Thanks for the fix, but the button has to blink longer.
I passed a level killing that skeleton guy, and it went immediately to that cut screen, and I didn't know to press the stats button when I passed a level. :cry:

Re: What do you do when you pass a level?

Posted: Sat Mar 13, 2010 10:08 pm
by zander
Ah. I see what you mean. I fixed it.