Is there a way to keep track of Accuracy in a shmup?

KangavarkKangavark Member Posts: 62
edited September 2012 in Working with GS (Mac)
I'm making a Shoot 'em Up game, and I'd like to display the players accuracy percentage based on shots fired/enemies hit and display it on my game over/ retry screen. Is there a way to do this with GS?

thanks!

Comments

  • KangavarkKangavark Member Posts: 62
    anybody?
  • carlblanchetcarlblanchet Member Posts: 755
    edited September 2012
    Only way I can think of is:

    Making 2 integer attributes, 1 called ShotsFired, and the other called TargetsHit. As well as 1 index attribute called Accuracy.

    -Every time a shot is fired, change attribute ShotsFired to ShotsFired + 1.
    -Every time a shot is fired and the bullet hits a target (enemy), change attribute TargetsHit to TargetsHit + 1.

    Then in the game over scene in your actor that displays the accuracy, change attribute Accuracy to TargetsHit/ShotsFired. ( / = divided by )

    This will give you a # between 1.00 and 0.00, 1 obviously being 100% and 0 being 0%. You can then multiply this by 100, so it gives you a number between 0 and 100.

    Make sure to change all 3 attributes to 0 when leaving the game over scene so that the accuracy can be counted again next time the game is played.

    Hope this helps! :)
  • KangavarkKangavark Member Posts: 62
    God bless you @carlblanchet
    you're a genius!

    for anyone else doing this, your Display Text behavior should read:
    Text: game.Accuracy.."%" so it displays as a percentage instead of just a whole number
  • carlblanchetcarlblanchet Member Posts: 755
    You're welcome! :)
Sign In or Register to comment.