Wednesday, October 04, 2006

Terrorist firing bullets and hostages avoiding them

Here is the random event for when the terrorist shoots:

if RdmEvent=10 then begin // Terrorist shoots
if BulletTerrorist=0 then begin
BulletTerrorist:=1;
case TerroristPos
of 1: begin BulletATerroristPos:=1; end;
2: begin BulletBTerroristPos:=1; end;
3: begin BulletCTerroristPos:=1; end;
4: begin BulletDTerroristPos:=1; end;
end;
end;
end;


And the code for the hostages sitting down to avoid the terrorist's bullets:

// Hostages sit down when terrorist shoots
if BulletTerrorist=1 then begin
if ((BulletATerroristPos=1) and (ImageHostage1.visible=true)) then begin ImageHostage1.visible:=false; end;
if ((BulletBTerroristPos=2) and (ImageHostage2.visible=true)) then begin ImageHostage2.visible:=false; end;
if ((BulletCTerroristPos=3) and (ImageHostage3.visible=true)) then begin ImageHostage3.visible:=false; end;
if ((BulletDTerroristPos=2) and (ImageHostage4.visible=true)) then begin ImageHostage4.visible:=false; end;
end;

No comments: