Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Help me please :) (starfighter game with Delphi 6 + DelphiX)

  1. #11
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Help me please :) (starfighter game with Delphi 6 + DelphiX)

    offtopic: I like the smilys in you code!
    NecroSOFT - End of line -

  2. #12

    Help me please :) (starfighter game with Delphi 6 + DelphiX)

    Obrigado (Thanks :-)) Grudzio, I'll try your suggestion...it makes sense to do it the way you suggested...

    I'll post again when I figured it out :-)
    Wake up from the dream and live your life to the full

  3. #13

    Help me please :) (starfighter game with Delphi 6 + DelphiX)

    I have found that using two or more DXTimers will f*** things up (like, not work at all) dunno if this is just me doing something wrong or what...

  4. #14

    Help me please :) (starfighter game with Delphi 6 + DelphiX)

    yeah you are not supposed to use 2, I read it somewhere that it is limited to 1 anyway.

    I use carlo Barbosa's threaded timer at the moment but I have only ever needed the use for one.

  5. #15

    Help me please :) (starfighter game with Delphi 6 + DelphiX)

    i edit your code:

    Code:
    procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
    begin
    
    //You are drawing before check DXDraw1.CanDraw
      DXDraw1.Surface.Fill(0);
      DXSpriteEngine1.Draw;
      DXImageList1.Items.Find('Earth').Draw(DXDraw1.Surface, Earthx, Earthy,0);
      DXImageList1.Items.Find('Explode1').Draw(DXDraw1.Surface, Explode1x, Explode1y,0);
      DXImageList1.Items.Find('Explode2').Draw(DXDraw1.Surface, Explode2x, Explode2y,0);
      DXImageList1.Items.Find('Planet').Draw(DXDraw1.Surface, Planetx, planety,0);
      if not DXDraw1.CanDraw then Exit;
    
      DXInput1.Update;
      DXSpriteEngine1.Move(1);
      DXSpriteEngine1.Dead;
      DXSpriteEngine1.Draw;
      if (player.Deaded) then begin
      if &#40;Player_No <= 2&#41; then
      NewPlayer
      else
      GameEnd;
    
    //here you disable dx timer...you will be unable to print anything on video by doing this!!!!
    //by disabling DX timer you "freeze" the game because the procedure TForm1.DXTimer1Timer is NEVER called.
    
    
    end;
      with DXDraw1.Surface.Canvas do
        begin
          Brush.Style &#58;= bsClear;
          Font.Size &#58;= 12;
          Font.Color &#58;= clTeal;
          Textout&#40;0,60, 'FPS&#58; '+inttostr&#40;DXTimer1.FrameRate&#41;&#41;;
          TextOut&#40;0,0,'Time&#58; ' + IntToStr&#40;Seconds&#41; + ', Enemy Ships left&#58; ' + IntToStr&#40;enimies&#41;&#41;;
          TextOut&#40;0,40, 'Lives left&#58; ' + IntToStr&#40;Lives&#41;&#41;;
      If &#40;Enimies = 0&#41; Then
        begin
          DXTimer1.Enabled &#58;= False;
          Timer1.Enabled &#58;= False;
          DXWaveList1.Items.Find&#40;'Tada'&#41;.Play&#40;False&#41;;
          Font.Size &#58;= 26;
          Font.Color &#58;= clYellow;
          TextOut&#40;290,220,'Game Over, your time&#58; ' + IntToStr&#40;Seconds&#41; + ' seconds'&#41;;
         end;
         Release;
    end;
    DXDraw1.Flip;
    end;
    hope it help!
    i suggest you to do not use Dx timer except of inizialize, finalize and print on video.
    Will: &quot;Before you learn how to cook a fish you must first learn how to catch a fish.&quot; coolest

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •