Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: shaun9991 on Tue 22/04/2014 14:07:56

Title: Creating Enemy Hitpoint gui
Post by: shaun9991 on Tue 22/04/2014 14:07:56
Hi guys,

I'm sorry if this is a stupid question, I know it's covered in the forum but it seems to be only for outdated versions of AGS. I'm trying to make a Pokemon style battle system, and I need the Enemy hitpoints to be displayed in a GUI. The players hitpoints are displayed via @score@, so this is fine. I have defined enemy hitpoints like so -

SetGlobalInt(5,50);

How do I translate that into a GUI text label to display the value?

Any help is much appreciated

Thanks
Shaun
Title: Re: Creating Enemy Hitpoint gui
Post by: Slasher on Tue 22/04/2014 15:19:41
Code (ags) Select

function repeatedly_execute()  // GLOBAL asc
{
LSCORE.Text = String.Format("%d", game.score); // This is will display @SCORE@ at present time on Label LSCORE and will increase if you add to game.score (or minus of course).
}


Code (ags) Select

game.score=(game.score+70); // One way of adding 70 to @SCORE@. There is a shorter way but outcome is the same.


From the manual:
QuoteNOTE: GlobalInts are now considered obsolete. Consider using global variables instead, which allow you to name the variables.

@SCORE@ is an AGS built in score system.

You may also need Game.DoOnceOnly in some cases. It's in the help manual.

Hope this helps
Title: Re: Creating Enemy Hitpoint gui
Post by: shaun9991 on Tue 22/04/2014 16:23:38
Many many thanks Slasher, exactly what I needed :)