Page 1 of 2 12 LastLast
Results 1 to 25 of 28

Thread: Catch - A game made in Lazarus

  1. #1
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Cool Catch - A game made in Lazarus

    Hey guys,

    This is the first program I made in lazarus. It's a simple game where the objective is to click the ball, and as you advance, the ball gets faster and faster. Click carefully though, because if you miss the ball, you lose a life. Advancing levels gives you two lives. The game is made by me, and Vinyl Scratch helped debug it. He also made some sound tracks, but I don't know how to add them.

    Heres the source for any interested, and below is a zipped file with the source code file(If you have Lazarus) and the .exe, along with the other stuff it built with...

    Let me know what I can improve on, and what you think I should add to this game!

    Known Bugs:

    None, looking for suggestions.

    Source code:
    Code:
    unit Unit1;
    
    {$mode objfpc}{$H+}
    
    interface
    
    uses
      Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
      StdCtrls;
    
    type
    
      { TForm1 }
    
      TForm1 = class(TForm)
        Button1: TButton;
        Button2: TButton;
        Image1: TImage;
        Image2: TImage;
        Image3: TImage;
        Label1: TLabel;
        Label2: TLabel;
        Timer1: TTimer;
        Timer2: TTimer;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure Image1Click(Sender: TObject);
        procedure Image2Click(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
        procedure Timer2Timer(Sender: TObject);
      private
        { private declarations }
      public
        { public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.lfm}
    
    { TForm1 }
    
    var
      Up, Right:boolean;
      z, Level, fails:integer;
    
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
    
        if Up = True then
          Image1.Top := Image1.Top - z
        else
          Image1.Top := Image1.Top + z;
    
        if Right = True then
          Image1.Left := Image1.Left + z
        else
          Image1.Left := Image1.Left - z;
    
    
        if Image1.Top <= 0 then
          Up := False;
    
        if Image1.Top + Image1.Height >= Form1.Height then
          Up := True;
    
        if Image1.Left <= 0 then
          Right := True;
    
        if Image1.Left + Image1.Width >= Form1.Width then
          Right := False;
    end;
    
    procedure TForm1.Timer2Timer(Sender: TObject);
    begin
      Image2.visible := true;
    
      Timer2.Enabled := false;
    end;
    
    procedure TForm1.Image1Click(Sender: TObject);
    begin
      Level := Level + 1;
      Image1.Visible := False;
      Showmessage('Winner! Next level! Two lives gained!');
      Fails := (Fails - 2);
      Label2.Caption := IntToStr(10 - Fails);
      ShowMessage('Current Level: ' + IntToStr(Level));
      Timer1.Enabled := False;
      Button1.Caption := 'Next Level';
      Button1.Visible := True;
    
      z := z + 1;
    end;
    
    procedure TForm1.Image2Click(Sender: TObject);
    begin
      Fails := Fails + 1;
      Label2.Caption := IntToStr(10 - Fails);
      Image2.visible := false;
      Timer2.Enabled := true;
      Image3.visible := true;
    
      if Fails >= 10 then
        begin
          showmessage('Failed 10 times! Game over!');
          Image1.Visible := False;
          Timer1.Enabled := False;
          Button1.Visible := True;
          Label2.Caption := '10';
          Button1.Caption := 'Start Game';
          z := 5;
          Level := 1;
          Fails := 0;
        end;
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Randomize;
      case random(2) of
        1: up := true;
        0: up := False;
      end;
    
      Case random(2) of
        1: Right := True;
        0: Right := False;
      end;
    
      Timer1.Enabled := true;
      Button1.Visible := False;
      Image1.Top := 50;
      Image1.Left := 50;
      Image1.Visible := True;
    end;
    
    procedure TForm1.Button2Click(Sender: TObject);
    begin
      Application.Terminate;
    end;
    
    
    
    
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Image3.Visible := false;;
      Timer1.Enabled := False;
      Image1.Visible := False;
      Top := 100;
      z := 5;
      Level := 1
    
    
    end;
    
    end.
    Sorry I couldn't attach the files, they are too big. Here they are:

    .EXE(if you don't have laz): http://speedy.sh/ZgS68/Catch.exe

    Zipped file with source stuff: http://www.2shared.com/file/gNi0Bzvw/Catch.html
    Last edited by Footy; 11-22-2012 at 09:10 PM.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  2. #2
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Looks cool! Got to level 3, you have no idea how hard this is with a laptop touchpad

  3. #3
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I've never tried it with a laptop, I imagine its hard
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  4. #4
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Quote Originally Posted by Footy View Post
    I've never tried it with a laptop, I imagine its hard
    What's the highest level you've gotten to?

  5. #5
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Level 8 is the highest I've gotten. The click recognition is looking shaky atm, I'll try to fix it.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  6. #6
    Join Date
    Oct 2011
    Location
    Chicago
    Posts
    3,352
    Mentioned
    21 Post(s)
    Quoted
    437 Post(s)

    Default

    Got to level 5 was brutal, it doesn't register clicks like 70% of the time I click on the ball.




    Anti-Leech Movement Prevent Leeching Spread the word
    Insanity 60 Days (Killer workout)
    XoL Blog (Workouts/RS/Misc)

  7. #7
    Join Date
    Feb 2012
    Location
    Discord
    Posts
    3,114
    Mentioned
    37 Post(s)
    Quoted
    538 Post(s)

    Default

    wanna try this but 2shared still won't work for me :/

  8. #8
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Heres an alternate link to the .exe. Let me know if anyone needs an alternate link to the source. http://speedy.sh/qMMqe/Catch.exe
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  9. #9
    Join Date
    Feb 2012
    Location
    Discord
    Posts
    3,114
    Mentioned
    37 Post(s)
    Quoted
    538 Post(s)

    Default

    Quote Originally Posted by Footy View Post
    Heres an alternate link to the .exe. Let me know if anyone needs an alternate link to the source. http://speedy.sh/qMMqe/Catch.exe
    ty bro <3 gtg bed but will I'll play when I get in tomoz <3
    edit: just had a quick go, might have a go at making a script for it :P

  10. #10
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Haha, alright, let me know if you come up with anything

    Quote Originally Posted by [XoL] View Post
    Got to level 5 was brutal, it doesn't register clicks like 70% of the time I click on the ball.
    Sorry, I didn't see your comment. I'm trying to work on that, but I don't get why lazarus isn't registering clicks...
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  11. #11
    Join Date
    Mar 2012
    Location
    San Diego
    Posts
    760
    Mentioned
    4 Post(s)
    Quoted
    91 Post(s)

    Default

    Silly Norton thinking the .exe is a virus. I'll disable it and try this game out

  12. #12
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, Let me know how it is, and if theres anything you think I should add.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  13. #13
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    My avast ran it in a sandbox for me because "This file has just been added to the internet"

    Oh and I tried to make a macro for it but it kept not registering clicks

  14. #14
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Still trying to fix that issue, I have no idea how to fix it... Thanks for trying it!
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  15. #15
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Clicking issue fixed! New link: http://speedy.sh/mFz4k/Catch.exe
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  16. #16
    Join Date
    Oct 2011
    Location
    Chicago
    Posts
    3,352
    Mentioned
    21 Post(s)
    Quoted
    437 Post(s)

    Default

    Much much better! got to level 9, then was like merp too fast




    Anti-Leech Movement Prevent Leeching Spread the word
    Insanity 60 Days (Killer workout)
    XoL Blog (Workouts/RS/Misc)

  17. #17
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks, New version! It includes a level counter, and you won't lose a life if you missclick the next level button.

    http://speedy.sh/ZgS68/Catch.exe
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  18. #18
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Footy, GitHub dude =P, You can even use GitHub pages to host the exe.

    Anyways, Should of made it in Simba =P

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  19. #19
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Really? I've never really used github, maybe I'll take a look at it later. I'd have made it in simba but I'm not good enough with simba forums.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  20. #20
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    My bot gets to level 50 plus with ease, but pressing enter sometimes will close to game because of the cross being the default enter action.
    Working on: Tithe Farmer

  21. #21
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Working on: Tithe Farmer

  22. #22
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    That's awesome, it gets it instantly. Bit short on antiban though, Footy will ban you

  23. #23
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol, I could probably make an antibot system in 5 min, and be more effective then jagex. My careers teacher just got to lvl 29 legit, someone needs to beat it.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  24. #24
    Join Date
    Feb 2012
    Location
    Discord
    Posts
    3,114
    Mentioned
    37 Post(s)
    Quoted
    538 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    Quote Originally Posted by BMWxi View Post
    That's awesome, it gets it instantly. Bit short on antiban though, Footy will ban you
    double posting nub ;0
    jks nice bot :P

  25. #25
    Join Date
    Apr 2012
    Posts
    3,356
    Mentioned
    34 Post(s)
    Quoted
    218 Post(s)

    Default

    Quote Originally Posted by The Killer View Post
    double posting nub ;0
    jks nice bot :P
    amazing bot lol

    got to 9.. it's made me irritable
    Last edited by Benny; 11-23-2012 at 04:00 PM.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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