Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Tue 06/11/2012 09:31:26

Title: Label flash
Post by: Slasher on Tue 06/11/2012 09:31:26
Hi

The 'SHOP' (gui) I am constructing has all the maths working correctly and I now have a small issue to clear up.

I have the label LElfers which displays The Int Elfers.

I have it stop at 10 yet it flashes a number (number can vary depending on product) very briefly before displaying 10.

Here's the bit of code for that part (Rep Exe Always):

Code (AGS) Select
if (Elfers >=  10)
{
   Elfers= 10;


If you can assist I thank you




Title: Re: Label flash
Post by: Khris on Tue 06/11/2012 11:43:26
Are you setting the label's text before or after that?
Because if you're setting it before that code, it'll show the higher value for one frame.
Title: Re: Label flash
Post by: Slasher on Tue 06/11/2012 12:02:56
Hi Khris

I see what you mean, it's being updated before the condition!

I have it declared:

Code (AGS) Select

Lelfers.Text = String.Format("%d", Elfers);


Then:

The Elfers label changes when an item is brought or cancelled but should never go over 10.
Code (AGS) Select

// STOP COUNT IF OVER 10
}
if (Elfers >=  10)
{
   Elfers= 10;




Also never under 0.

Code (AGS) Select

}
if (Elfers <=  0)
{
  Elfers= 0;
}


I do have a couple of minor issues if you have the time to help Khris?

Thank you

slasher


Title: Re: Label flash
Post by: Khris on Tue 06/11/2012 15:02:41
In case that wasn't entirely clear, what you're supposed to do is move the label update below the checks so the label is only ever updated with the correct value.

If you have other issues, just post them here, in case you were thinking of sending me a PM. I'm currently at work and I'm sure others can help you just as well as I.
Title: Re: Label flash
Post by: Slasher on Tue 06/11/2012 17:41:50
Cheers Khris