SRL Archive - Game Development

Catch - A game made in Lazarus


Footy

2012-11-21 16:57:23

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. :p

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:
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

Ian

2012-11-21 17:09:17

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

Footy

2012-11-21 17:14:47

I've never tried it with a laptop, I imagine its hard :p

Ian

2012-11-21 17:15:43

From: Footy
I've never tried it with a laptop, I imagine its hard :p


What's the highest level you've gotten to?

Footy

2012-11-21 17:18:26

Level 8 is the highest I've gotten. The click recognition is looking shaky atm, I'll try to fix it.

[XoL]

2012-11-21 17:21:38

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

The Killer

2012-11-21 17:22:16

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

Footy

2012-11-21 17:24:23

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

The Killer

2012-11-21 17:44:34

From: Footy
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

Footy

2012-11-21 17:58:20

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

From: [XoL]
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…

Prometheus

2012-11-21 18:03:21

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

Footy

2012-11-21 18:14:35

Ok, Let me know how it is, and if theres anything you think I should add. :)

Ian

2012-11-21 18:19:46

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

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

Footy

2012-11-21 18:25:57

Still trying to fix that issue, I have no idea how to fix it… Thanks for trying it! :)

Footy

2012-11-22 15:47:41

Clicking issue fixed! New link: http://speedy.sh/mFz4k/Catch.exe

[XoL]

2012-11-22 15:57:09

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

Footy

2012-11-22 16:10:19

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

Dgby714

2012-11-22 16:24:14

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

Anyways, Should of made it in Simba =P

Footy

2012-11-22 16:28:13

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. :p

masterBB

2012-11-22 16:46:40

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.

masterBB

2012-11-22 17:01:59

[YOUTUBE]dZksgs56fFQ[/YOUTUBE]

Ian

2012-11-22 19:01:07

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

Footy

2012-11-23 09:13:46

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.

The Killer

2012-11-23 10:53:31

From: masterBB
[YOUTUBE]dZksgs56fFQ[/YOUTUBE]


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

double posting nub ;0
jks nice bot :P

Benny

2012-11-23 10:55:44

From: The Killer
double posting nub ;0
jks nice bot :P


amazing bot lol

got to 9.. it's made me irritable

The Killer

2012-12-01 07:14:21

got to 160 with 250 lives before accidently pressing enter -.-

The Killer

2013-04-13 18:35:41

BUMP IDC how dead this is, I love this game :P
Got back into botting it:

someone beat me? I think @Sjoekeloe already did :S

masterBB

2013-04-13 19:12:54

The problem used to be that the click area wasn't aligned with the red circle when it became too fast.