-1

i explain my probleme : i have a worm game like this enter image description here

i have to go to the next level if i hit SUCCESSIVELY 10 worm
i have 3 points live, if i dont hit a worm live = live -1, 0 live : game over

in the 2nd level there 2 warms shown simultaneous, level 3 there are 3 shown ..

i cant find a solution to count the 10 successive hits.

can you tell me how to proceed? thank you.

4

2 回答 2

2

如果我弄错了,请原谅我,但你为什么不能用一个变量来跟踪它?

var lives = 3;
var streakcount = 0;
while(streakcount < 10 && lives > 0)
{
    do_level_logic();
    if(hit)
        streakcount++;
    else if(miss)
    {
        streakcount = 0;
        lives--;
    }
}

你能详细说明一下你需要什么吗?

或者,也许您需要一个功能,让您有一定的时间限制来获得另一次命中,以继续连胜。

于 2012-04-23T18:17:24.603 回答
0
define streak=0
on success_hit_event streak++
if streak==10 level_up
on miss_hit_event { streak=0; live-- }
于 2012-04-23T18:18:41.803 回答