Hi all, I'm busy with a game made with Delphi and DelphiX. It works fine and the frames per second is around 250. Problem is (maybe it's not a problem at all) that when the app runs my PC'S CPU fan goes on and I can see from the windows task manager that it uses around 90 to 98 % CPU. Is this normal? My code is lengthy so I won't put everything here.
A portion of my code:
[pascal]procedure TForm1.Man1Create;
begin
Man1 := TMan1.Create(DXSpriteEngine1.Engine);
Man1.Image := DXImageList1.Items.Find('Man1');
Man1.X := 30;
Man1.Y := -500;
Man1.Speed := 1;
Man1.Width := Man1.Image.Width;
Man1.Height := Man1.Image.Height;
Man1.PixelCheck := False;
end;
procedure TMan1.DoMove(MoveCount: Integer);
begin
if road.Moved = true then
y := y+1;
if y > Form1.DXDraw1.Height - 100 then
dead;
if (Movement = 0) Then
Movement := Random(2);
if X > 560 Then Movement := 1;
if X < 50 Then Movement := 2;
Case Movement of
1:
begin
If Image = Form1.DXImageList1.Items.Find('Man1') Then
X := X - Speed
end;
2:
begin
if Image = Form1.DXImageList1.Items.Find('Man1') Then
X := X + Speed
end;
end;
end; [/pascal]
I have 19 men with each one more or less the same code as above, is it possible to do it in one procedure? The x and y parameters and the image is different for all 19.
Thanks for your time :-)
Bookmarks