Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: barefoot on Mon 29/08/2011 11:52:46

Title: SOLVED: Problem displaying total kills on gui using labels and ints
Post by: barefoot on Mon 29/08/2011 11:52:46
Hi

as an afterthought (though not a hard case must have) I decided it may be an idea to show labels on a gui that would show the number of enemy killed per item.

These items are: planes, tanks, boats, factories, caves

Like for example the labels would display :

Planes: 5 Destroyed
Tanks: 5 Destroyed
Boats: 5 Destroyed
Caves: 5 Destroyed


Starting off i made a Global Variable: Planes Int 0

Also a label (planes) on the gui

Then after shooting a Plane I added

Planes = (Planes + 1);

In Global repeatedly_execute_always() i put:

planes.Text="Kills,$%d,Planes";


Unfortunately it shows the whole text (including $%d) and not the Total.. Something is obviously not right.. Could you give me a bit of a leg up?

cheers

barefoot


Title: Re: Problem displaying total kills on gui using labels and ints
Post by: Matt Frith on Mon 29/08/2011 12:02:31
I believe it should be

planes.Text=String.Format("Kills,%d",Planes);

edit: Removed the '$' symbol.
Title: Re: Problem displaying total kills on gui using labels and ints
Post by: barefoot on Mon 29/08/2011 12:15:17
Yarr Tier,

I just did that myself but I thank you for your reply.. The others should be much easier to do now.

planes.Text = String.Format("Planes Destroyed: %d", Planes);

:=

cheers

barefoot