45 lines
864 B
ObjectPascal
45 lines
864 B
ObjectPascal
unit sun_m;
|
|
|
|
interface
|
|
|
|
uses creature_m;
|
|
|
|
const
|
|
SunSlowMovespeed = 2;
|
|
SunFastMovespeed = 4;
|
|
SunStartDX = SunSlowMovespeed;
|
|
SunStartDY = SunSlowMovespeed;
|
|
SunSymbol = 's';
|
|
|
|
procedure InitRandomSun(var g: creature);
|
|
|
|
implementation
|
|
|
|
uses arena_m, Math, math_m;
|
|
|
|
procedure InitSun(var g: creature; x, y, sigdx, sigdy: integer);
|
|
begin
|
|
g.t := creatureSun;
|
|
g.curX := x;
|
|
g.curY := y;
|
|
g.dX := SunStartDX * sigdx;
|
|
g.dY := SunStartDY * sigdy;
|
|
g.movespeed := SunSlowMovespeed;
|
|
g.alive := true;
|
|
g.animation := 1;
|
|
g.symbol := SunSymbol
|
|
end;
|
|
|
|
procedure InitRandomSun(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);
|
|
InitSun(g, x, y, sigdx, sigdy)
|
|
end;
|
|
|
|
end.
|