(Solved) Displaying player score using my own variables

Started by Stupot, Tue 19/03/2013 00:29:01

Previous topic - Next topic

Stupot

In my game don't want to use the in-built game.score/@SCORE@ system to display the scores because it complicates things I am trying to achieve.  I'd rather use my own variables.  The trouble is (unless I am missing something) I can't show the current value of a variable in a GUI label unless I do use @SCORE@.

I can show the values using Display, but that obviously comes up in a display box which pauses the game.  Is there a way for the score to be displayed constantly in the top corner, much like the normal score system but with my own variables?

I'm sure there's an easy way round it, but I'm going round in circles trying to figure it out :(
MAGGIES 2024
Voting is over  |  Play the games

Khris

In repeatedy_execute:

Code: ags
  lblScore.Text = String.Format("%d out of 100", my_score_variable);

Crimson Wizard

Quote from: Khris on Tue 19/03/2013 00:50:03
In repeatedy_execute:

Code: ags
  lblScore.Text = String.Format("%d out of 100", my_score_variable);


Also, if there's a helper function which sets (adds. etc) new score value, you may place this label update there.
Putting this in repeatedly_execute will grant 100% ensurance that label will display correct value all the time, but it will, well, repeatedly execute :).
The optimal choice depends on complexity of situation.

Stupot

#3
Ahh thanks guys. So simple and elegant. I'll give it a try.

[Update] Worked like a charm. Thanks again :-)
MAGGIES 2024
Voting is over  |  Play the games

SMF spam blocked by CleanTalk