43 lines
826 B
ObjectPascal
43 lines
826 B
ObjectPascal
|
|
unit ghost_m;
|
||
|
|
|
||
|
|
interface
|
||
|
|
|
||
|
|
uses creature_m;
|
||
|
|
|
||
|
|
const
|
||
|
|
GhostMovespeed = 1;
|
||
|
|
GhostStartDX = GhostMovespeed;
|
||
|
|
GhostStartDY = GhostMovespeed;
|
||
|
|
GhostSymbol = 'g';
|
||
|
|
|
||
|
|
procedure InitRandomGhost(var g: creature);
|
||
|
|
|
||
|
|
implementation
|
||
|
|
|
||
|
|
uses arena_m, Math, math_m;
|
||
|
|
|
||
|
|
procedure InitGhost(var g: creature; x, y, sigdx, sigdy: integer);
|
||
|
|
begin
|
||
|
|
g.t := creatureGhost;
|
||
|
|
g.curX := x;
|
||
|
|
g.curY := y;
|
||
|
|
g.dX := GhostStartDX * sigdx;
|
||
|
|
g.dY := GhostStartDY * sigdy;
|
||
|
|
g.moveSpeed := GhostMovespeed;
|
||
|
|
g.alive := true;
|
||
|
|
g.animation := 1;
|
||
|
|
end;
|
||
|
|
|
||
|
|
procedure InitRandomGhost(var g: creature);
|
||
|
|
var
|
||
|
|
x, y, sigdx, sigdy: integer;
|
||
|
|
begin
|
||
|
|
sigdx := IfThen(RandomBool, 1, -1);
|
||
|
|
sigdy := IfThen(RandomBool, 1, -1);
|
||
|
|
x := RandomLR(2, ArenaW - 1);
|
||
|
|
y := RandomLR(2, ArenaH - 1);
|
||
|
|
InitGhost(g, x, y, sigdx, sigdy)
|
||
|
|
end;
|
||
|
|
|
||
|
|
end.
|