Par la même occasion, j'aimerais bien savoir la façon de temporiser.
Voici mon code :
plugin TBombPlugin
hint 'Plugin des bombes';
on AfterConstruction do
begin
inherited;
MaxLength := 1;
end;
on PressKey do
var
ObjectBomb : TObjectBomb;
Square : TSquare;
BombEffect : TEffect;
Map: TMap;
Pos, OrigPos: T3DPoint;
Dir: TDirection;
Len, I: Integer;
QPos: TQualifiedPos;
begin
Map := Player.Map;
OrigPos := Player.Position;
Pos := PointBehind(OrigPos, Dir);
Len := 0;
QPos.Map := Map;
if Key <> Ord('B') then
Exit;
if Player can ExplosObstacle then
Square.Effect := BombEffect;
BombObject.Count := BombObject.Count - 1;
Temporize;
Temporize;
OrigPos + 1;
OrigPos.Obstacle := nil;
end else
Player.PlaySound ('Sol.wav');
end;
end;