SRL Archive - Other Scripts

[Game(?)] OMGBALLS


GoF

2008-07-13 09:12:25

Yeah. I wrote a game, or atleast I count it as a game at 3am or so last night :D

First thing I've made with SCAR since ages ago so if it's nubby don't blame me..

Oh yeah and seizure warning, flashing stuff ;) If you're sensitive make the ballcount smaller and background flashing interval bigger..

The idea of this "game" is to eat the other balls with your blue ball by moving the blue ball over the other "enemy" balls. Control the blue ball with your mouse.


//OMGBALLS. Best game ever. Made by GoF`
//eat the other balls with the blue ball.
//Move with the mouse.. ball follows your cursor.
//Flashy stuff.. Seizure warning xD
program OMGBALLS;

const
OtherBC = 85; // How many enemy balls to spawn? Max 155, min 1.
TXT = True; // Show the text ingame?
BGInterval = 125; // Interval (in ms) between background color changes??
// (smaller = faster)
type
Balls = record
Loc: TPoint;
Lx1, Ly1, Lx2, Ly2: Integer; // last size as size changes.. for eat checking
end;

var
OBForm: TForm;
T: TVariantArray;
FCanvas: TCanvas;
BufImg, R, Score, BCTimeout: Integer;
OtherBalls: array of Balls;
BlueBall: Balls;

function ReBornBall: Balls; //remake a ball.
begin
Result.Loc.X := Random(410) + 20;
Result.Loc.Y := Random(410) + 20;
Result.Lx1 := Result.Loc.X;
Result.Ly1 := Result.Loc.Y;
Result.Lx2 := Result.Loc.X;
Result.Ly2 := Result.Loc.Y;
end;

function InBlue(Sx, Sy, Ssx, Ssy: Integer): Boolean; // checks if enemy is in your area
begin
if (Sx < BlueBall.Lx2) and
(Sy < BlueBall.Ly2) and
(Sx > BlueBall.Lx1) and
(Sy > BlueBall.Ly1) then
begin
Result := True;
Exit;
end;
if (Ssx < BlueBall.Lx2) and
(Ssy < BlueBall.Ly2) and
(Ssx > BlueBall.Lx1) and
(Ssy > BlueBall.Ly1) then
Result := True;
end;

var
LastTxt: Integer;

procedure Draw(Sender: TObject); // drawing..
var
Ct: Integer;
DIt: Boolean;
begin
SafeDrawBitmap(BufImg, FCanvas, 0, 0); // black background.
if (TXT) and (LastTxt > 5) then // move and update text every 5 frames.
begin
LastTxt := 1;
with FCanvas do
begin
Font.Name := 'Arial';
Font.Size := 10 + Random(15);
Font.Color := Random(16777215);
TextOut(Random(120), Random(400), 'OMGBALLS - The Game.');
end;
end;
Inc(LastTxt);
for Ct := 0 to High(OtherBalls) do // your worst enemies
begin
DIt := True;
if not InBlue(OtherBalls[Ct].Lx1, OtherBalls[Ct].Ly1, OtherBalls[Ct].Lx2, OtherBalls[Ct].Ly2) then
begin // if not eaten then randomize new size..
OtherBalls[Ct].Lx1 := OtherBalls[Ct].Loc.X - 7 + Random(9);
OtherBalls[Ct].Ly1 := OtherBalls[Ct].Loc.Y - 7 + Random(9);
OtherBalls[Ct].Lx2 := OtherBalls[Ct].Loc.X + 7 + Random(9);
OtherBalls[Ct].Ly2 := OtherBalls[Ct].Loc.Y + 7 + Random(9);
end else
begin // and if eaten...
OtherBalls[Ct] := ReBornBall;
Inc(Score);
ClearDebug;
Writeln('YOU ATE AN ENEMY BALL! CONGRATULATIONS!');
Writeln('Current score: ' + IntToStr(Score) + '!');
DIt := False;
end;
if DIt then
with FCanvas do
begin
Brush.Style := bsSolid;
Brush.Color := Random(16777215);
Pen.Width := 1;
Pen.Color := Random(16777215);
Ellipse(OtherBalls[Ct].Lx1, OtherBalls[Ct].Ly1, OtherBalls[Ct].Lx2, OtherBalls[Ct].Ly2);
end;
end;
BlueBall.Lx1 := BlueBall.Loc.X - 17 + Random(11); // your ball
BlueBall.Ly1 := BlueBall.Loc.Y - 17 + Random(11);
BlueBall.Lx2 := BlueBall.Loc.X + 17 + Random(11);
BlueBall.Ly2 := BlueBall.Loc.Y + 17 + Random(11);
with FCanvas do
begin
Brush.Style := bsSolid;
Brush.Color := clBlue;
Pen.Width := 1;
Pen.Color := clBlue;
Ellipse(BlueBall.Lx1, BlueBall.Ly1, BlueBall.Lx2, BlueBall.Ly2);
end;
end;

procedure MMove(Sender: TObject; Shift: TShiftState; x, y: Integer);
begin
BlueBall.Loc.X := x;
BlueBall.Loc.Y := y;
end;

procedure ChangeBG(Sender: TObject); // new background color
begin
FastDrawClear(BufImg, Random(16777215));
end;

procedure Init; // form
var
Time: TTimer;
Time_: TTimer;
begin
with OBForm do
begin
Width := 450;
Height := 450;
Position := poDefault;
BorderIcons := [biSystemMenu];
BorderStyle := bsSingle;
Caption := 'OMGBALLS - The Game.';
Color := 0;
OnPaint := @Draw;
OnMouseMove := @MMove;
end;
FCanvas := OBForm.Canvas;
Time := TTimer.Create(OBForm);
with Time do
begin
Interval := 29;
OnTimer := @Draw;
end;
Time_ := TTimer.Create(OBForm);
with Time_ do
begin
Interval := BGInterval;
OnTimer := @ChangeBG;
end;
OBForm.ShowModal;
end;

procedure MakeBalls;
var
MBC: Integer;
begin
for MBC := 0 to High(OtherBalls) do
begin
OtherBalls[MBC].Loc.X := Random(410) + 20;
OtherBalls[MBC].Loc.Y := Random(410) + 20;
OtherBalls[MBC].Lx1 := OtherBalls[MBC].Loc.X - 5 + Random(8);
OtherBalls[MBC].Ly1 := OtherBalls[MBC].Loc.Y - 5 + Random(8);
OtherBalls[MBC].Lx2 := OtherBalls[MBC].Loc.X + 5 + Random(8);
OtherBalls[MBC].Ly2 := OtherBalls[MBC].Loc.Y + 5 + Random(8);
end;
BlueBall.Loc.X := 225;
BlueBall.Loc.Y := 225;
end;

procedure StartUp; // startup
begin
ClearDebug;
Writeln('OMGBALLS - The Game. By GoF` ');
Writeln('Have fun.');
Wait(2500);
Score := 0;
OBForm := CreateForm;
BufImg := BitmapFromString(450, 450, '');
FastDrawClear(BufImg, 0);
SetArrayLength(OtherBalls, OtherBC)
MakeBalls;
end;

begin
StartUp;
ThreadSafeCall('Init', T);
end.

sirlaughsalot

2008-07-13 09:21:58

/has a seizure… 0_0 holy crap

noidea

2008-07-13 10:03:17

That was like so insane! I couldn't even play the game and "eat" the balls because I was so distracted about the flashing colours!

ShowerThoughts

2008-07-13 10:20:29

[Brainwashed]
GoF is Uber p0wnage :p
[/Brainwashed]

Good job on screwing my eyes :p

Freddy1990

2008-07-25 06:04:39

Brain meltdown…

StrikerX

2008-07-25 06:40:26

*Argh* My eyes….Very addictive

MasterKill

2008-07-25 07:27:03

Current score: 1101!

I died after that score, Good game gof, I expected nothing else form you

OMG BALLS :p

Esteban

2008-07-25 08:51:09

colors! Pretty colors! Make it full screen then use some acid, and man would that be trippy!

Laur€ns

2008-07-28 05:09:06

Goddam you, now I have an headache :(

doom0791

2008-07-29 01:44:16

LOL that's awesome…


Current score: 31337!

0wn 4 skill

2008-08-05 15:42:36

YOU ATE AN ENEMY BALL! CONGRATULATIONS!
Current score: 1164!
Successfully executed

Timer

2008-08-05 16:15:12

Mother F*cker, im still seeing balls!!!


YOU ATE AN ENEMY BALL! CONGRATULATIONS!
Current score: 43745!

Harry

2008-08-05 16:32:38

Argh I stopped it and I am still seeing balls too… and it crashed SCAR.