Results 1 to 5 of 5

Thread: My First Published Pascal Game

  1. #1

    My First Published Pascal Game

    Hello Community this is my first game developped on Delphi7. I was very quick beacuse of time (i wanted to use this game on th e contest, but i don¬Ąt know where or who sendit). Maybe with more time and new ideas i could make something better.OK There is:

    http://www.2shared.com/file/9460332/...f4/Basket.html
    Live programming, eat programming, breath programming and die programming

  2. #2

    Re: My First Published Pascal Game

    Nice little game.
    I remember one of my first Delphi games I made was quite similar.

    There is one issue though: The images are flickering, put
    [pascal]
    DoubleBuffered := true;
    [/pascal]
    in your FormCreate - procedure to solve that.

    If you mean the PGD Annual Arcadia-Contest go to http://www.pgdannual.com/, register, login in and submit your game. I've noticed if you want to compete you need to implement the "Insert coin"-rule.
    Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
    Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)

    Programmer: A device for converting coffein into software.

  3. #3

    Re: My First Published Pascal Game

    OW sorry I get that link too late. I think i will wait next contest. So, Can I keep still uploading my proyects here?
    Live programming, eat programming, breath programming and die programming

  4. #4

    Re: My First Published Pascal Game

    Stoney:
    Last time you advice me about the flickering of my images. I had do what you suggested me but I think the flickering is still there. Look this is teh code


    Code:
     unit main;
    
    interface
    
    uses
     Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
     Dialogs, ExtCtrls;
    
    type
     TForm1 = class(TForm)
      Timer1: TTimer;
      procedure FormCreate(Sender: TObject);
      procedure FormPaint(Sender: TObject);
      procedure FormDestroy(Sender: TObject);
      procedure FormKeyDown(Sender: TObject; var Key: Word;
       Shift: TShiftState);
      procedure Timer1Timer(Sender: TObject);
     private
      mike:TBitmap;
      mike_pos:TPOint;
      start_pos:TPoint;
      gravedad,jumpspeed:integer;
      jumping:Boolean;
     public
      { Public declarations }
     end;
    
    var
     Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    mike:=TBitmap.Create;
    mike.LoadFromFile('migue.bmp');
    gravedad:=2;
    jumpspeed:=-25;
    jumping:=False;
    mike_pos.X:=20;
    mike_pos.Y:=ClientHeight-mike.Height;
    start_POs.X:=Mike_Pos.X;
    start_POs.Y:=ClientHeight-mike.Height;
    
    end;
    
    procedure TForm1.FormPaint(Sender: TObject);
    begin
    DoubleBuffered:=True;
    Canvas.Draw(mike_pos.X,mike_pos.Y,mike);
    
    end;
    
    procedure TForm1.FormDestroy(Sender: TObject);
    begin
    mike.Free;
    end;
    
    procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
     Shift: TShiftState);
    begin
    if Key=VK_SPACE then
     jumping:=True;
    if key=VK_LEFT then
     dec(mike_pos.X,10);
    if key=VK_RIGHT then
     inc(mike_pos.X,10);
    
    end;
    
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
     Canvas.Brush.Color:=clWhite;
     Canvas.Rectangle(0,0,ClientWidth,ClientHeight);
     Canvas.Draw(mike_pos.X,mike_pos.Y,mike);
     if jumping then
     begin
      inc(jumpspeed,gravedad);
      mike_pos.Y:=mike_pos.Y+jumpspeed;
      Canvas.Brush.Color:=clWhite;
      Canvas.Rectangle(0,0,ClientWidth,ClientHeight);
      Canvas.Draw(mike_pos.X,mike_pos.Y,mike);
       if mike_pos.Y>start_pos.Y then
       begin
       jumping:=False;
       mike_pos.Y:=start_pos.Y;
       Canvas.Draw(mike_pos.X,mike_pos.Y,mike);
       jumpspeed:=-25;
       end;
     end; 
    end;
    
    end.
    And here is the example:

    http://www.2shared.com/file/11058299...43/Miguel.html
    Live programming, eat programming, breath programming and die programming

  5. #5

    Re: My First Published Pascal Game

    You should put the DoubleBuffered-Line in the FormCreate-procedure, not in the FormPaint-procedure. Try:
    Code:
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    DoubleBuffered:=True;
    [...Rest of the code...]
    end;
    You can use [ pascal ] [ /pascal ] or [ code ] [ /code ] - Tags to show the code formatted.

    For future games you might want to take a look into SDL/DirectX/OpenGL or engines based on those graphic libraries like Andorra2D, Asphyre, Phoenix, etc.
    Canvas is good for starters, but the performance is going the get slower and slower the more and more images you are drawing on the screen.
    Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
    Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)

    Programmer: A device for converting coffein into software.

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
  •