On start of layout i count all enemies in layout and add to global variable
for example globalvariable Oponents = 13
for example when i kill 10 enemies
counter should display 76.92% killed
how do that?
Make your counter display :
str(round(EnemiesKilled/Opponents*10000)/100)&"%"
Round(x *100)/100 is a good trick to have only two decimals left
works! thank you so much
but sprite font dont display '%' ;/
Make your counter display : str(round(EnemiesKilled/Opponents*10000)/100)&"%" Round(x *100)/100 is a good trick to have only two decimals left
Where i should put that code to have only two decimals?
works! thank you so much but sprite font dont display '%' ;/
you can edite the spritefont on a character that you don't use, here i have edited the / into %, so if you have to call the % you have to type /
It was just to explain you how it worked.
Just copy that :
And edit the SpriteFont like RetroInsight said.
> > > Just copy that : > str(round(EnemiesKilled/Opponents*10000)/100)&"%" > > . >
>
> Just copy that :
> str(round(EnemiesKilled/Opponents*10000)/100)&"%"
> .
All works fine, but its possible to round up to receive 77% not 76.92% like before?
Sprite font need lot of space to display each character so if less its better to display
Develop games in your browser. Powerful, performant & highly capable.
Yup
str(round(EnemiesKilled/Opponents*100))&"%"
Thank you Semoreh!