- Home /
Combo score counter issues
Hello everyone. I'm trying to create a simple combo scoring system where it multiplies the current combo by 250 and then adds it to the level overall combo score. This is what I came up with so far
void Update(){
//GameManager.Points represent the combo counter. each
// enemy dead is +1 combo
currentcombo = GameManager.Points;
comboscore = 250*currentcombo;
}
public void UpdateComboScore()
{
LevelComboScore = currentscore + LevelComboScore ;
}
I'm not sure why but on the first x1 combo the LevelComboScore stays at 0 and after that, it doesn't add up correctly.
Can you post all code related to your combo's? The issue might be where you're changing the value of Points, or where you're calling UpdateComboScore.
I've tried calling the UpdateComboScore function on enemy death and I've tried calling it on a button press to see if its actually working but the same thing happens. I've also checked if the points are adding up correctly on the game manager and it seems to be good. $$anonymous$$aybe the way I'm doing this is wrong? Do you have any suggestions on how else I would do this combo score thing?
Answer by jkpenner · Apr 20, 2020 at 03:10 AM
I’m not sure what exactly is causing your problem, but for a simple combo handler you could create something similar to the following:
public int Score { get; private set; }
public int ComboPoints { get; private set; }
public void ApplyScore(int scoreAmount) {
this.Score += (scoreAmount * this.ComboPoints);
}
public void IncreaseCombo() {
this.ComboPoints++;
}
public void ResetCombo() {
this.ComboPoints = 1;
}
The ApplyScore would be call whenever an object gives the player score. It will then modify that score amount by the current combo points before applying it to the total score. After you apply a score you would then call IncreaseCombo.
Hopefully this helps you figure out your issue.
This seems like a way better way of doing it than $$anonymous$$e. Thank you! :)
Your answer
Follow this Question
Related Questions
Ragepixel Animation Help! 1 Answer
mecanim blend tree attack combo 2 Answers
Why my score system not working? 1 Answer