var
Map: TMap;
Pos: T3DPoint;
X, Y, Z: Integer;
begin
Map := Player.Map;
Pos := Player.Position;
Map[Point3D(X-1, Y-1, Z)].Effect := nil;
Map[Point3D(X, Y-1, Z)].Effect := nil;
Map[Point3D(X+1, Y-1, Z)].Effect := nil;
//.........etc
D'avance merci !
var
Map: TMap;
Pos: T3DPoint;
X, Y, Z: Integer;
begin
Map := Player.Map;
Pos := Player.Position;
Map[Point3D(X-1, Y-1, Z)].Effect := nil;
Map[Point3D(X, Y-1, Z)].Effect := nil;
Map[Point3D(X+1, Y-1, Z)].Effect := nil;
//.........etc
X := Player.Position.X;
field TDarkGround
name 'Terre sombre';
image 'terresombre';
on DoDraw do
begin
inherited;
DissipateGroundNeighbors(Context);
end;
end;
field TIndestructibleWall(TWall)
name 'Mur indestructible';
on DoDraw do
begin
inherited;
EditVisualTag := 'X';
end;
end;
(...)
for I:= -1 to 1 do
for J:= -1 to 1 do
begin
if (Map[Point3D(X+I, Y+J, Z)].Field <> IndestructibleWall) and
(Map[Point3D(X+I, Y+J, Z)].Field <> Water) then
Map[Point3D(X+I, Y+J, Z)].Field := DarkGround;
if Map[Point3D(X+I, Y+J, Z)].Field = Water then
Map[Point3D(X+I, Y+J, Z)] := Water;
end;
(...)
if not ((Map[Point3D(X+I, Y+J, Z)].Field is TIndestructibleWall) or
(Map[Point3D(X+I, Y+J, Z)].Field is TWater)) then
unit Bomb;
uses
FunLabyBase;
components
BombPlugin: TBombPlugin;
Bombs: TBombs;
DarkGround: TDarkGround;
ExploseLight : TExploseLight;
IndestructibleWall : TIndestructibleWall;
Bomb : TObjectTool
ObjectDef: Bombs;
FindMessage: 'Tu as trouvé une bombe ! '+
'Tu peux la faire exploser avec la touche B.';
end;
field TDarkGround
name 'Terre sombre';
image 'terresombre';
on DoDraw do
begin
inherited;
DissipateGroundNeighbors(Context);
end;
end;
field TExploseLight
name 'Explosion';
image 'ExploseL';
on DoDraw do
begin
inherited;
DissipateGroundNeighbors(Context);
end;
end;
field TIndestructibleWall(TWall)
name 'Mur indestructible';
on DoDraw do
begin
inherited;
EditVisualTag := 'X';
end;
end;
plugin TBombPlugin
hint 'Plugin de la bombe';
on PressKey do
var
Map: TMap;
X, Y, Z: Integer;
I, J: Integer;
begin
if Key = Ord('B') then
begin
Map := Player.Map;
X := Player.Position.X;
Y := Player.Position.Y;
Z := Player.Position.Z;
Player.PlaySound('ImpactBomb.wav');
Player discards 1 Bombs;
for I:= -1 to 1 do
for J:= -1 to 1 do
begin
if not((Map[Point3D(X+I, Y+J, Z)].Field is TIndestructibleWall) or
(Map[Point3D(X+I, Y+J, Z)].Field is TWater)) then
Map[Point3D(X+I, Y+J, Z)]:= ExploseLight;
end;
Player.Color :=$FF000080;
Sleep(100);
Player.Color :=$FF0000FF;
for I:= -1 to 1 do
for J:= -1 to 1 do
begin
if not ((Map[Point3D(X+I, Y+J, Z)].Field is TIndestructibleWall) or
(Map[Point3D(X+I, Y+J, Z)].Field is TWater)) then
Map[Point3D(X+I, Y+J, Z)].Field := DarkGround;
if (Map[Point3D(X+I, Y+J, Z)].Field is Water) then
Map[Point3D(X+I, Y+J, Z)] := Water + nil;
end;
end;
end;
end;
object TBombs
name 'Bombe';
image 'Bombe';
on SetCount do
begin
inherited;
if Value > 0 then
Player.AddPlugin(BombPlugin)
else
Player.RemovePlugin(BombPlugin);
end;
end;
end.
if (Player.Tag = 53) and (DiffPlugin.Diff <> 1) then
begin
repeat
Esc53X := Random(94)+1;
Esc53Y := Random(94)+1;
Master.Map['BoardColors'].Map[Point3D(Esc53X, Esc53Y, 2)].Effect := DownStairs;
Master.Map['BoardColors'].Map[Point3D(Esc53X, Esc53Y, 1)].Effect := UpStairs;
if Master.Map['BoardColors'].Map[Point3D(Esc53X, Esc53Y, 1)].Field <> Grass then
begin
Master.Map['BoardColors'].Map[Point3D(Esc53X, Esc53Y, 2)].Effect := nil;
Master.Map['BoardColors'].Map[Point3D(Esc53X, Esc53Y, 1)].Effect := nil;
end;
until Master.Map['BoardColors'].Map[Point3D(Esc53X, Esc53Y, 1)].Effect = UpStairs;
end;
var
Map: TMap;
Esc53X, Esc53Y: Integer;
begin
if ... then
begin
Map := Master.Map['BoardColors'];
// D'abord trouver une bonne paire (X, Y)
repeat
Esc53X := Random(94)+1;
Esc53Y := Random(94)+1;
until (Map[Point3D(Esc53X, Esc53Y, 1)].Field is TGround) and
(Map[Point3D(Esc53X, Esc53Y, 2)].Field is TGround);
// Puis placer les escaliers
Map[Point3D(Esc53X, Esc53Y, 1)].Effect := UpStairs;
Map[Point3D(Esc53X, Esc53Y, 1)].Effect := DownStairs;
end;
end;
DerF_44La classe de Grass.
(C'est quoi “TGround” ?.. La classe des terrains où le joueur peut se déplacer ??..)