adding a score counter? best practice.
by Jabari A Dumisani · in Torque X Platformer Kit · 02/25/2010 (6:35 pm) · 2 replies
hello, hope all are well. i was wondering has anyone added a score counter to the Platformer Kit? im trying to see where or how would i approach adding one, or altering the life counter to function if i wanted to add points values to the peppers instead of these going toward added lives? thanks for your time, have a great evening.
About the author
independent animator/game developer. :)
#2
Just thinking out loud, but the above is a really really simple way of doing things - perhaps too simple. There is probably a better way, but I posted this to just give an idea of how to go about implementing this.
When your collectible components are confirming pickup, you can then call the CalculateScoreIncrease method, passing an identifier object (like a string, object type or something) to work out how to increment the score.
The score can then be fed to the user via the GUIText controls, such as the text for the lives.
Sorry if I've got the wrong idea here.
03/08/2010 (5:08 pm)
public class ScoreCounter
{
private int _score;
public Score
{
get { return _score }
set { _score = value}
}
public ScoreCounter()
{
_score = 0;
}
public void CalculateScoreIncrease( object to_pass_here )
{
if ( to_pass_here == [a certain thing] )
{
this.Score += 10;
}
else if ( to_pass_here == [another thing] )
{
this.Score += 20;
}
}
}Just thinking out loud, but the above is a really really simple way of doing things - perhaps too simple. There is probably a better way, but I posted this to just give an idea of how to go about implementing this.
When your collectible components are confirming pickup, you can then call the CalculateScoreIncrease method, passing an identifier object (like a string, object type or something) to work out how to increment the score.
The score can then be fed to the user via the GUIText controls, such as the text for the lives.
Sorry if I've got the wrong idea here.
Torque Owner Jabari A Dumisani
if no one from the community can answer, then im appealing to anyone from GG can step in and assist.