Results 1 to 4 of 4

Thread: DelphiX Game (Delphi 6) - Intro Screen

  1. #1

    DelphiX Game (Delphi 6) - Intro Screen

    Hi, me again (My game looks very nice and I've sorted out most of the bugs...it's a starfighter game)

    I would like to add an intro (bitmap) and when the app starts it should 1st show the bitmap and when the user enteres a key the app should run.

    Does anyone have examples/code/suggestions?

    Thank you.
    Wake up from the dream and live your life to the full

  2. #2

    DelphiX Game (Delphi 6) - Intro Screen

    Does your game use a State system for the main game loop?

    Although I don't use DelphiX for my game, I display a splash screen while my game resources are being loaded, before my main game loop is reached.

    If you have a state system then you should be able to do this easily.


    Code:
    While not quitting
    Begin
    
      Case GameState of
        Intro:
           Blit into image to screen canvas.
           Do Into specific input checks - Change GameState to MainMenu when key pressed
    
        MainMenu:
           Do main menu stuff
           Do Menu specific input checks - Change GameState to InGame when new game is pressed, or Quitting when Quit is pressed.
        InGame:
           Do Game stuff
           Do game specific input checks - Change GameState to MainMenu when killed or Esc pressed.
        Quitting:
           Render Quitting image
           
           set Quitting Flag to True
      end
    
    Do Generic input checks
    Flip surfaces.
    
    end
    Hope this makes sense.

    My state machine is similar, but a bit more complicated, it uses LastState, NewState and CurrentState sections. It gives me a lot of flexibility.

    Hope this helps..

    P.S. you might want to put this sort of post in the DelphiX section in future, although this request appears to be for a generic answer... unless you're after DelphiX code.. but seriously, this is so noddy, it won't take you long to implement.

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

    DelphiX Game (Delphi 6) - Intro Screen

    What I do: Start main loop, Render a loading screen image to the screen, load resources, This could take a while so the engine is unable to render as it is loading and after this you just render you thing to the screen (menu, game, etc)

    ...State machine would be better...
    NecroSOFT - End of line -

  4. #4

    DelphiX Game (Delphi 6) - Intro Screen

    Thanks guys, I got it to work the way I wanted to :-)

    Here's the code for a 1024*768 bitmap to be displayed when the app starts if anyone else needs it

    Code:
    procedure TForm1.Splash;
    begin
      DXSpriteEngine1.Engine.Moved := False;
      with TSplash.Create(DXSpriteEngine1.Engine) do
        begin
          Image:= Form1.DXImageList1.Items.Find('Splash');
          Width:= Image.Width;
          Height:= Image.Height;
          X:= (Form1.DXDraw1.Width-Width) div 2;
          Y:= ((Form1.DXDraw1.Height-Height) div 2) + (Height -780);
          Z:= 5;
         end;
    end;
    
    
    procedure TSplash.DoMove(MoveCount: Integer);
    begin
      inherited DoMove(MoveCount);
      if Form1.Start_Intro then
      begin
        Y:= Y+100;
        if Y > Form1.DXDraw1.Height+Height+10 then
          begin
            Dead;
          end;
      end;
    end;

    I called DXSpriteEngine1.Engine.Moved := False in the splash procedure to 'pause' the game while the bitmap is displayed and TRUE in the eventhandler of the return key to play the game.
    Wake up from the dream and live your life to the full

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
  •