Wednesday, October 04, 2006

Killing the terrorist

Here is the code when the bullet hits the terrorist:

// Kill terrorist - Win 30 points
if ((BulletAHeroPos=5) and (TerroristPos=1)) or
((BulletBHeroPos=5) and (TerroristPos=2)) or
((BulletCHeroPos=5) and (TerroristPos=3)) or
((BulletDHeroPos=5) and (TerroristPos=4)) then begin
Cntrls:=false;
Blocked:=true;
StopAllTimers;
CicloTimer:=1;
TimerKillTerrorist.interval:=500;
TimerKillTerrorist.Enabled:=true;
Row:=Row+1;
Score:=Score+30;
PlaySound(pfEvent);
end;


And the animated sequence:

case CicloTimer
of 1: begin ArrayTerrorist[TerroristPos].visible:=(not ArrayTerrorist[TerroristPos].visible); Blocked:=false; end;
2: begin ArrayTerrorist[TerroristPos].visible:=(not ArrayTerrorist[TerroristPos].visible); end;
3: begin
if ((BulletAHeroPos=5) and (TerroristPos=1)) then begin ImageBulletA4.visible:=false; SetupHero; end;
if ((BulletBHeroPos=5) and (TerroristPos=2)) then begin ImageBulletB4.visible:=false; SetupHero; end;
if ((BulletCHeroPos=5) and (TerroristPos=3)) then begin ImageBulletC4.visible:=false; SetupHero; end;
if ((BulletDHeroPos=5) and (TerroristPos=4)) then begin ImageBulletD4.visible:=false; SetupHero; end;
TimerKillTerrorist.Enabled:=false; TimerLevel2.Enabled:=true; end;
end;
Inc(CicloTimer);

No comments: