Creating Enemy Hitpoint gui

Started by shaun9991, Tue 22/04/2014 14:07:56

Previous topic - Next topic

shaun9991

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
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

Slasher

#1
Code: ags

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

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

shaun9991

Many many thanks Slasher, exactly what I needed :)
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

SMF spam blocked by CleanTalk