SCAR Code:
program DotGame;
var
Dot,Back,x,y,a,z,GDot:Integer;
TheBox:TBox;
procedure RandDot;
begin
a:= 1 + Random(244);
z:= 1 + Random(245);
SafeDrawBitmap(GDot,GetDebugCanvas,a,z)
end;
procedure SetUp;
begin
DisplayDebugImgWindow(250,250);
ActivateClient;
Dot:= BitmapFromString(5,5,'');
GDot:= BitmapFromString(5,5,'');
Back:= BitmapFromString(250,250,'');
SafeDrawBitmap(Back,GetDebugCanvas,0,0);
FastDrawClear(Dot,2480383);
SafeDrawBitmap(Dot,GetDebugCanvas,125,125);
RandDot;
x := 125;
y := 125;
end;
Procedure CheckTheDot;
begin;
TheBox.x1:=a-5;
TheBox.y1:=z-5;
TheBox.x2:=a+5;
TheBox.y2:=z+5;
if IntInBox(x,y,TheBox) then
begin
RandDot;
Writeln('cool');
end;
end;
procedure DotMoveLeft;
begin
repeat
FastDrawClear(Back,0);
FastDrawClear(GDot,2990379);
FastDrawTransparent(x,y,Dot,Back);
FastDrawTransparent(x,y,Dot,GDot);
x:=x+1;
SafeDrawBitmap(Back,GetDebugCanvas,0,0);
SafeDrawBitmap(GDot,GetDebugCanvas,a,z);
CheckTheDot;
Wait(10);
until(x>=246) or (IsArrowDown(0)) or (IsArrowDown(2)) or (IsArrowDown(3)) or (IsFunctionKeyDown(0));
end;
procedure DotMoveDown;
begin
repeat
FastDrawClear(Back,0);
FastDrawClear(GDot,2990379);
FastDrawTransparent(x,y,Dot,Back);
FastDrawTransparent(x,y,Dot,GDot);
y:=y+1;
SafeDrawBitmap(Back,GetDebugCanvas,0,0);
SafeDrawBitmap(GDot,GetDebugCanvas,a,z);
CheckTheDot;
Wait(10);
until(y>=246) or (IsArrowDown(0)) or (IsArrowDown(1)) or (IsArrowDown(3)) or (IsFunctionKeyDown(0));
end;
procedure DotMoveRight;
begin
repeat
FastDrawClear(Back,0);
FastDrawClear(GDot,2990379);
FastDrawTransparent(x,y,Dot,Back);
FastDrawTransparent(x,y,Dot,GDot);
x:=x-1;
SafeDrawBitmap(Back,GetDebugCanvas,0,0);
SafeDrawBitmap(GDot,GetDebugCanvas,a,z);
CheckTheDot;
Wait(10);
until(x<=-1) or (IsArrowDown(0)) or (IsArrowDown(1)) or (IsArrowDown(2)) or (IsFunctionKeyDown(0));
end;
procedure DotMoveUp;
begin
repeat
FastDrawClear(Back,0);
FastDrawClear(GDot,2990379);
FastDrawTransparent(x,y,Dot,Back);
FastDrawTransparent(x,y,Dot,GDot);
y:=y-1;
SafeDrawBitmap(Back,GetDebugCanvas,0,0);
SafeDrawBitmap(GDot,GetDebugCanvas,a,z);
CheckTheDot;
Wait(10);
until(y<=-1) or (IsArrowDown(1)) or (IsArrowDown(2)) or (IsArrowDown(3)) or (IsFunctionKeyDown(0));
end;
begin
SetUp;
repeat
if (IsArrowDown(1)) then
DotMoveLeft;
if (IsArrowDown(2)) then
DotMoveDown;
if (IsArrowDown(3)) then
DotMoveRight;
if (IsArrowDown(0)) then
DotMoveUp;
until(false);
end.