コラム / テトリスぽいもの / 38



スコア=レベル×同時消しの二乗×10
の実装ですが、
同時消し の数は、ついさっき、
lcでカウントするようにしたので、
ほんのちょいと弄るだけです。
procedure TMapBlocks.DeleteBlocks;
var i:integer;
   f:boolean;
   lc:integer;
begin
   (略)
   if lc>0 then begin
       Form1.level.Caption:=IntToStr(StrToInt(Form1.level.Caption)+1);
       if Form1.level.Caption='100' then Form1.level.Caption:='99';
   end;
end;
procedure TMapBlocks.DeleteBlocks;
var i:integer;
   f:boolean;
   lc:integer;
begin
   (略)
   if lc>0 then begin
       Form1.level.Caption:=IntToStr(StrToInt(Form1.level.Caption)+1);
       if Form1.level.Caption='100' then Form1.level.Caption:='99';
   end;
   Form1.score.Caption:=
       IntToStr(
           StrToInt(Form1.score.Caption)+
           (StrToInt(Form1.level.Caption)+1)*sqr(lc)*10
       );
end;
スコアのcaptionを数値に直したものと、
レベルのcaptionを数値に直して1足したものと行数の二乗と10をかけたものを
足して、
また文字列に直してcaptionにはめなおしてます。
1足してるのは、レベル0だと*0で0点になっちゃうからね。
うーむ ゴリゴリウホウホ