Hi,
i wanted a simple score counter for my spaceship game. (a counter from "00 to 99")
But the code doesn`t works good. First problem is that every time i shoot down an enemy the counter count`s +2. But in the code i wrote "score_value += 1;". Why it counts too much?
The second problem is that the score counter stops at "08". After that, it doesn`t count anymore,but why?
(both codes are based on the AUM37)
Here is the code for the counter:
/////////////////////////////score_counter///////////////////////
font score_font_01 = <scorefont_01.tga>, 15, 15;
string score_str = "0";
string temp_str;
var score_value = 0;
text score_txt
{
pos_x = 188;
pos_y = 47;
layer = 9;
font = score_font_01;
string = score_str;
flags = visible;
}
starter compute_score()
{
while (1)
{
str_for_num(temp_str, score_value);
if (str_len(temp_str) == 1)
{
str_cpy(score_str, "0");
str_cat(score_str, temp_str);
}
if (str_len(temp_str) == 2)
{
str_cat(score_str, temp_str);
}
wait (1);
}
}
And thats the code for the enemy:
function destroy_drone()
{
if(you.skill40 == 1234)
{
score_value += 1;
}
...
thx for help (and sorry for my bad english)