Procedure
TPlayerSprite.DoMove(MoveCount:
Integer);
begin
inherited
DoMove(MoveCount);
//
if
isLeft
in
frmDelphiX1.DXInput.States
then
x:=x-5;
//
if
isRight
in
frmDelphiX1.DXInput.States
then
x:=x+5;
//
if
isup
in
frmDelphiX1.DXInput.States
then
begin
if
Distance-oldDistance>=17
then
begin
Inc(Distance);
with
TBullet.Create(Engine)
do
begin
PixelCheck
:=
True;
Image
:=
frmDelphiX1.dxImageList.Items.Find('Bullet');
//
X
:=
Self.X+Self.Width
-40;
//
Y
:=
Self.Y+Self.Height
-80;
Width
:=
Image.Width;
Height
:=
Image.Height+2;
end;
end;
oldDistance
:=
Distance;
//
-
Distance:=0;
end;
if
y
>=
frmDelphiX1.DXDraw.SurfaceHeight-image.Height
then
//
y
:=
frmDelphiX1.DXDraw.SurfaceHeight-image.Height;
//
if
x
>=
frmDelphiX1.DXDraw.SurfaceWidth
-image.Width
then
//
x
:=
frmDelphiX1.DXDraw.SurfaceWidth
-image.Width;
//
if
y
<=
0
then
y
:=
1;
if
x
<=
0
then
x:=1;
Distance:=Distance+MoveCount
end; |