uses
Classes, SysUtils, Graphics;
type
TBase=
class
private
x:
Integer
;
y:
Integer
;
public
constructor
Create(x0, y0:
Integer
);
procedure
setX (x0:
Integer
);
procedure
setY (y0:
Integer
);
function
getX:
Integer
;
function
getY:
Integer
;
end
;
TStatic=
class
(TBase)
private
bitmap: TBitmap;
public
constructor
Create(x0, y0:
Integer
; bitmap0: TBitmap);
procedure
setBitmap (bitmap0: TBitmap);
function
getBitmap: TBitmap;
end
;
TAnimate=
class
(TBase)
private
bitmap:
array
[
0..100
]
of
TBitmap;
curFrame:
Integer
;
maxFrame:
Integer
;
public
constructor
Create(x0, y0:
Integer
; bitmap0:
array
of
TBitmap;
maxFrame0:
Integer
);
procedure
nextFrame;
procedure
setBitmap(bitmap0:
array
of
TBitmap);
function
getCurFrame:
Integer
;
function
getMaxFrame:
Integer
;
function
getBitmap:TBitmap;
end
;
constructor
TAnimate
.
Create(x0, y0:
Integer
; bitmap0:
array
of
TBitmap;
maxFrame0:
Integer
);
begin
x:=x0;
y:=y0;
bitmap:=bitmap0;
curFrame:=
0
;
maxFRame:= maxFrame0;
end
;
procedure
TAnimate
.
nextFrame;
begin
if
curFrame < maxFrame
then
curFrame:=curFrame+
1
else
curFrame:=
0
;
end
;
procedure
TAnimate
.
setBitmap(bitmap0:
array
of
TBitmap);
begin
bitmap:=bitmap0;
end
;
function
TAnimate
.
getCurFrame:
Integer
;
begin
result:= curFrame;
end
;
function
TAnimate
.
getMaxFrame:
Integer
;
begin
result:= maxFrame;
end
;
function
TAnimate
.
getBitmap: TBitmap;
begin
result:=bitmap[curFrame];
end
;
constructor
TStatic
.
Create(x0, y0:
Integer
; bitmap0: TBitmap);
begin
x:=x0;
y:=y0;
bitmap:=bitmap0;
end
;
procedure
TStatic
.
setBitmap(bitmap0: TBitmap);
begin
bitmap:=bitmap0;
end
;
function
TStatic
.
getBitmap: TBitmap;
begin
result:=bitmap;
end
;
constructor
TBase
.
Create(x0, y0:
Integer
);
begin
x:=x0;
y:=y0;
end
;
procedure
TBase
.
setX(x0:
Integer
);
begin
x:=x0;
end
;
procedure
TBase
.
setY(y0:
Integer
);
begin
y:=y0;
end
;
function
TBase
.
getX:
Integer
;
begin
result:=x;
end
;
function
TBase
.
getY:
Integer
;
begin
result:=y;
end
;
end
.