SRL Archive - First Scripts

PONG! - The Game!


BazzBarrett

2008-07-30 19:40:37

not realy my first script just the first 1 ive posted on here =P
you may enconter the debug window just minimising by itself =\ if anyone can tell me how to get round that it would b a grate help =).
i just did this in the last 1-2 hours got bored =P, though i made a fairly good job of it (well it worked.) I havent put anything fancy in it i might later and post the fancy version on here.

ps: hope u like games in black and white i got lazy XD

EDIT: revisited it dident make the enermy bar cuz it would ahve taken 2 long but i updated canvas and everything..

Dan Cardin

2008-07-31 07:47:20

why cant the computer lose?

(if this is like real PONG then) there should be a computer paddle, and the score goes up per win i think… but great game! i could play that for a while :).

Laur€ns

2008-07-31 08:37:37

you lose!
your final score was 60!
Successfully executed

Pretty good for a first script!

ShowerThoughts

2008-07-31 10:33:20

Good work for first script, but HORRRIBLE Scripting Standards, I fixed the most ;) for you

program New;

function startup(var buffer:integer):boolean;//startup the display
begin
DisplayDebugImgWindow(300, 300);// display the screen
Buffer := BitmapFromString(300, 300, '');//buffer to draw onto
Result := True
//movetotray;
end;

function loadbmps(var Ball, Bg, Bar :Integer):Boolean;//load the imiges
begin
Ball := BitmapFromString(15, 15, 'beNr7/59swIANEK8Sq3oGQoA8' +
'xQzEgaGrmHZBR2oMkpo2CAMAzC/7BQ==');
SetTransparentColor(ball, clWhite);
Bar := BitmapFromString(8, 34, 'beNo7cAAPaMAAcHEGJDAqPio+1M' +
'WxpnMsAAA2QiAQ');
SetTransparentColor(bar, clWhite);
Bg := BitmapFromString(300, 300, 'beNrt2j1u4lAUgNEsl0WwBFbA' +
'BujpkdLR0lJS0lHSZa640tOL/7AxaJJwTjEyBhvw+OM9W/n4AAAAA' +
'AAAAAAA/oyv747H44ve4uGPdD6fl8vli97rdd8CHji1ttvtKzJ8rM' +
'FcXq1WsXy5XN6kwfi+p9OpvcybNPiiM21Og1M3/+0N1u9i5NVg2O/' +
'31+s11sRC4zXxK3292Ww25an43Y41u92u3s/lZs44mO8eO4nlxWIR' +
'y/Fv5/iY28aAHh+jHkRiNhsP89nYar1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2CBgENggYBDYIGQYMaBA2CBjUIGgQNahA0CBrU' +
'IGgQNKhB0CBoUIOgQdCgBkGDoEENggZBgxoEDYIGNQgaBA1qEDQIG' +
'tQgaBA0qEHQIGhQg6BB0CCgQdAgoEHQIKBB0CCgQdAgoEHQIKBB0C' +
'CgQdAgaFCDoEHQoAZBg6BBDYIGQYMaBA2CBjUIGgQNahA0CBrUIGg' +
'QNKhB0CBoUIOgQdCgBkGDoEENggZBgxoEDYIGNQgaBA1qEDQIGgQ0' +
'CBoENAgaBDQIGgQ0CBoENAgaBDQIGgQ0CBoEDWoQNAga1CBoEDSoQ' +
'dAgaFCDoEHQoAZBg6BBDYIGQYMaBA2CBjUIGgQNahA0CBrUIGgQNK' +
'hB+IENyhD+e4MAAAAAAAAAAAAAAAAA9/0D6I+OGw==');
Result := True;
end;


function Movement(var X, y:Integer; Speed:integer):Boolean;
begin
If(IsArrowDown(0) = True)then y := y - Speed;
if(IsArrowDown(2) = True)then y := y + Speed;
Result := True;
end;

function Bound(var X, y:Integer):Boolean;
begin
if(X < 20)then X := 20;
if(X > 250)then X := 250;
if(y < 50)then y := 50;
if(y > 250)then y := 250;
Result := True;
end;

function BallMove(var X, y, XX, yy, DirX, Diry, Count:integer):boolean;
begin
if(XX < 38)then
begin
if((yy < y - 15) or (yy > (y + 34)))then//you Missed the ball.
begin
Writeln('you lose!');
Writeln('your final score was '+inttostr(Count)+'!');
Terminatescript;
end else
begin
DirX := 2;
Diry := - 3 + Random(6);
Inc(Count);
end;
end;
if(XX > 270)then
begin
XX := 270;
DirX := - 2;
end;
if( yy > 270)then
begin
yy := 270;
Diry := - 2;
end;
if(yy < 45)then
begin
yy := 45;
Diry := 2;
end;
XX := XX + DirX;
yy := yy + Diry;
Result := True;
end;

var
Buffer, T: Integer;
Ball, Bg, Bar: Integer;
X, y, XX, yy: Integer;
DirX, Diry, Count:integer;
begin
startup(buffer);
loadbmps(ball, bg, bar);
X:=30
y:=150
XX:=random(50)+125
yy:=random(50)+125
DirX:=2
Diry:=-3+random(6)
Count:=0
Wait(500);
repeat
FastDrawClear(Buffer, clGreen);//fill the screen green
Movement(X, y, 3);//controls movement
BallMove(X,y, XX, yy, DirX, Diry, Count);// controlls the ball
Bound(X, y);//controls the walls
FastDrawTransparent(0, 0, Bg, buffer);//draw the background
FastDrawTransparent(X, y, Bar, buffer);//draw the bar
FastDrawTransparent(XX, yy, Ball, buffer);//draws the ball
T := CreateBitmapFromText('your Current Score Is: '+inttostr(Count)+'!', UpChars, clwhite);//score
FastDrawTransparent(65, 27, T, buffer);//draw teXt
SafeDrawBitmap(Buffer, GetDebugCanvas, 0, 0);//display the final result
Wait(10);//Wait 0.01 secounds
until(False)
end.
//Hermpie is the sex.^^

BazzBarrett

2008-07-31 11:16:27

thx that looks so much better =) like i said i might add some fancy stuf in a day or 2 if i get some spare time and make it look a bit nicer ill post a v2 if i do. did any1 else come across the debug window just minimising?

ShowerThoughts

2008-07-31 11:17:43

Not really ;)

Griff

2008-07-31 14:51:43

nice game, man! its pretty addicting :P
I got 76 alurenssie :D

Laur€ns

2008-07-31 15:01:19


Successfully compiled (655 ms)
you lose!
your final score was 30!
Successfully executed
Successfully compiled (47 ms)
you lose!
your final score was 0!
Successfully executed
Successfully compiled (45 ms)
you lose!
your final score was 45!
Successfully executed
Successfully compiled (46 ms)
you lose!
your final score was 13!
Successfully executed
Successfully compiled (46 ms)
you lose!
your final score was 26!
Successfully executed
Successfully compiled (45 ms)
you lose!
your final score was 39!
Successfully executed
Successfully compiled (45 ms)
you lose!
your final score was 91!
Successfully executed
Successfully compiled (45 ms)
you lose!
your final score was 0!
Successfully executed
Successfully compiled (45 ms)
you lose!
your final score was 15!
Successfully executed

Mehehehe (h)

Waddo

2008-07-31 19:49:54

Wd Bazz old friend good luck on clay softener

Moebius

2008-08-28 20:08:33

I would like to try it, but cant compile it, it keeps giving me errors :o
Is it updated? :confused:

P1nky

2008-08-28 21:35:56

it works for me
great job

jakeyboy29

2008-08-29 13:38:21

you lose!
your final score was 1565645546544565656543654565656565366546454556!
Successfully executed

Rich

2008-08-29 13:55:02


Woo?

jakeyboy29

2008-08-29 14:09:32

mint. beats my fake.

Rich

2008-08-31 14:35:03

Lol, it's as easy as going to line 149:

t:=createbitmapfromtext('Your Current Score Is: '+inttostr(count)+'!', UpChars, clwhite);//score

And changing:

Your Current Score Is: '+inttostr(count)+'!', UpChars, clwhite);

To

Your Current Score Is: '9999', UpChars, clwhite);

And plus there's no need to mess around in Paint of PhotoShop.

Look:


jakeyboy29

2008-08-31 14:39:47

lol mint :D

Markus

2008-08-31 14:46:20

I'm loving it <3

Rich

2008-08-31 15:45:29

I played around with it a little more, and here's the result. It's rather colourful…

Bazzbarret, if you want me to remove this, please tell me.

jakeyboy29

2008-08-31 15:47:50

nice, i like

Tniffoc

2008-08-31 23:51:21

That's amazing for a first script! I like it!:D