Allegro.cc - Online Community

Allegro.cc Forums » The Depot » 2007 Allegro ScreenHack, 80x25 compo

This thread is locked; no one can reply to it. rss feed Print
2007 Allegro ScreenHack, 80x25 compo
Trezker
Member #1,739
December 2001
avatar

What... No comment on me?
Well, here's version 0.3.
+Varying power on bullets
+Wimsy seeker bullet, really powerful but may take some time to find target

1#include <allegro.h> // Crimson by Anders Andersson
2int i,j,*b,a,r=10,e,k=0,h[100],t,s=0,m,p=2;char u;float x[100],y[100],v[100],
3w[100],X,Y;T(){++t;}C(N,S,C){circle(b,x[N],y[N],S,C);}R(N){return rand()%N;}main
4(){srand(time(0));x[0]=400;y[0]=300;h[0]=99;for(i=1;i<100;++i)h<i>=0;
5allegro_init();install_keyboard();install_timer();install_mouse();install_int(T,
650);set_gfx_mode(2,800,600,0,0);b=create_bitmap(800,600);while(!key[59]){rest(1)
7;if(h[0]>0){if(!--t)continue;if(key[83])x[0]++;if(key[82])x[0]--;if(key[85])
8y[0]++;if(key[84])y[0]--;mouse_b?++a:a;++e;for(i=1;i<99;++i){if(h<i><=0){if(i<50
9&&e>99){e-=99;y<i>=R(2)?-10:610;x<i>=R(2)?-10:810;if(R(2))x<i>=R(800);else y<i>=
10R(600);h<i>=10;}else if(i>50&&mouse_b&&a>r){a-=r;x<i>=x[0];y<i>=y[0];float a=
11atan2(mouse_y-y[0],mouse_x-x[0]);v<i>=cos(a);w<i>=sin(a);h<i>=p;}}else{if(i<50){
12float a=atan2(y[0]-y<i>,x[0]-x<i>);x<i>+=cos(a);y<i>+=sin(a);C(i,5,4);for(j=50;j
13<99;++j){X=x<i>-x[j];Y=y<i>-y[j];if(X*X+Y*Y<99&&h[j]>0){h<i>-=h[j];h[j]=0;if(
14h<i><=0){++k;u=R(2)?'M':R(2)?'L':'S';x[99]=x<i>;y[99]=y<i>;h[99]=1;}break;}}X=
15x<i>-x[0];Y=y<i>-y[0];if(X*X+Y*Y<99)--h[0];}else{if(x<i><0||x<i>>800||y<i><0||
16y<i>>600)h<i>=0;m=R(49)+1;if(s&&h[m]>0){float a=atan2(y[m]-y<i>,x[m]-x<i>);v<i>
17+=cos(a);w<i>+=sin(a);}x<i>+=v<i>;y<i>+=w<i>;C(i,1,7);}}}if(h[99]){X=x[99]-x[0];
18Y=y[99]-y[0];if(X*X+Y*Y<99){s=0;h[99]=0;if(u=='L'){r=2;p=1;}if(u=='M'){r=10;p=2;
19}if(u=='S'){s=1;r=25;p=10;}}textprintf(b,font,x[99],y[99],15,"%c",u);}C(0,5,3);
20circle(b,mouse_x,mouse_y,3,9);textprintf(b,font,8,580,15,"Kills: %d Health: %d",
21k,h[0]);}else{textprintf(b,font,300,300,15,"Game over: %d kills",k);if(
22key[KEY_ENTER]){x[0]=400;y[0]=300;h[0]=99;for(i=1;i<100;++i)h<i>=0;}}blit(b,
23screen,0,0,0,0,800,600);clear(b);}}END_OF_MAIN()

Matthew Leverton
Supreme Loser
January 1999
avatar

Quote:

Matthew Leverton: Tetris?... I already played a Tetris entry... oh, and you can keep getting points by holding down, even after the piece has hit the bottom, I assume it's a glitch?

I said:

scoring for pressing the down key is generous (especially if you bump against the side), but it's good enough for demo #1.

kenmasters1976
Member #8,794
July 2007

There are some really fun entries. Well done everybody!.

Arvidsson, great job on all your entries.
I find the first one actually quite fun. It would be nice if you could save boosts between levels.
In your second entry I think some asteroids are pretty hard to see. I made it to level 7, time 92... by simply staying in a corner almost all time.
I'm no good at Sokoban. I tried level 2 twice and give up.

Neil Black, all I see is a black screen and a shooter. Nothing to shot at. Yet scored 600 pts.

Mokkan, your pong entry works fine. What else can I say?.

netcat, your space invaders idea seems interesting but I can hardly see the shots.

HardTranceFan, the maze seems too long. Perhaps that's the point?.

Jeff Bernard, all I get is a black screen with the red square at the bottom.

Trezker, nice game. Got 93 kills in version 0.3.

Kikaru, you know... you can go trough boxes.

Matthew Leverton, wow! 15 lines?.

Matthew Leverton
Supreme Loser
January 1999
avatar

I added color (each piece is a different color that is 'remembered' when placed) and now its up to 1,180 characters—almost 16 lines. :-/ In order to accomplish that, I had to replace the bitfield system with a more traditional char W[y][x].

So I have 740 characters to add the "next" indicator, sound effects, music, multiple modes of play including multiplayer (joystick, mouse, network, and artificial intelligence). :o

Jeff Bernard
Member #6,698
December 2005
avatar

Quote:

What... No comment on me?

I forgot, I wasn't sure what to say, really. I just played the newest version though, and I like the homing weapon.

Quote:

all I get is a black screen with the red square at the bottom.

Hmmm... I wonder if it's possible that the default palette would have the colors in different orders on different machines in 8 bit mode? Speaking of color, I hope I remembered to ensure that the centipede is never black... I'll look into this.

Quote:

scoring for pressing the down key is generous (especially if you bump against the side), but it's good enough for demo #1.

So my assumption was essentially correct. Man, I don't need to read anyone's posts!

--
I thought I was wrong once, but I was mistaken.

Matthew Leverton
Supreme Loser
January 1999
avatar

Here's my "final" version:

http://www.allegro.cc/files/attachment/595225

Windows binary: tetris.exe.

OS X binary: tetris.gz

1#include <allegro.h> // Tetris by Matthew Leverton
2int S,Y,x,R,j[]={0,1,2,3,4,6,8,1,2,2,2,4,4,4},D[]={0x0145,0x048C0123,0x14580156,
30x04591245,0x15691456,0x14594569,0x159A2456,0x126A4568,0x12590456,0x269A456A},X,
4a,c,d,l=0,s=0,g,*b,i,p,q,r,y,u,v,h=1,z,_=0,k=0;SAMPLE *e;float m=0,n;char W[24][
518],*K,*J;G(A,B,C,D){rectfill(b,A*16,B*16,A*16+D,B*16+D,C);}F(A,B,C){G(A,B,C>0&&
6C<16?C<8?0:C-8:C,15);G(A,B,C,13);}H(A,B,C,D){i=4;while(i--){F(A+(C&3),B+((C>>2)&
73),D+9);C/=16;}}B(){for(i=0;i<378;++i)F(i%18,i/18+1,W[i/18][i%18]);if(h)H(x,1+y,
8c,q),H(0,1,a,p);textprintf(b,font,4,4,15,"Lines: %d Score: %d / %d",l,s,v);blit(
9b,screen,0,0,0,0,288,352);rest(50);}C(A){c=D[j[A]+r/2]>>(r%2)*16;}Z(){y=0;x=7;q=
10p;p=rand()%7;r=0;d=10;C(p);a=c;C(q);}P(A){int C=c,D=0;for(i=0;i++<4;C>>=4){J=&W[
11y+(C>>2&3)][x+(C&3)];D+=A?*J=q+1:*J;}return D;}M(A,B){memset(W[A]+4,B,10);}main(
12){allegro_init();install_sound(-1,-1,0);srand(time(0));e=create_sample(8,0,22050
13,8192);J=(char*)e->data;for(i=0;i<e->len;){n=(e->len-i++)/(float)e->len*255;m=m*
140.75+(((rand()&255)/255.0)-0.5)/4.0;*(J++)=128+m*n;}v=get_config_int("s","h",0);
15set_gfx_mode(GFX_GDI,288,352,0,0);install_keyboard();b=create_bitmap(288,352);Z(
16);Z();memset(W,8,432);i=20;while(i--)M(i,0);while(h){_++;clear(b);X=x,Y=y,R=r,S=
17s;h=(K=key)[59]?0:1;if(--d){if(_-k>2){z=0;if(K[83])x++;else if(K[82])x--;else if
18(K[85])y++,s++;else z=1;k=z?0:k?k:_;}if(K[84]){if(!u)r=(r+1)%j[q+7],u=1;}else u=
190;}else y++;C(q);if(P(0)){x=X,y=Y,r=R,s=S,C(q);if(!d){P(1);Z();g=10;S=20;while(S
20--)if(!memchr(&W[S][4],0,10)){memmove(&W[1],W,S++*18);play_sample(e,255,55,1600,
210);M(0,0);++l;s+=g;g*=10;B();rest(50);}if(P(0))h=0;}}else if(!d)d=(d=10-l/10)<2?
222:d;if(s>v)v=s;B();}x=20;while(x--){M(x,8);B();}textout(screen,font,"Game Over",
23108,172,15);clear_keybuf();readkey();set_config_int("s","h",v);}END_OF_MAIN()

I still have two lines left, but I don't really feel like adding anything else. So it appears that I can write 23 lines of code before getting tired of the project.

The game features awesome Tetris gameplay, sound effects*, and a high score.

* What a waste of a couple lines of code.

Mokkan
Member #4,355
February 2004
avatar

I'll try to come up with a more original entry in the next couple days. ;)

HardTranceFan
Member #7,317
June 2006
avatar

I find it great that there has been quite a few neat little game ideas programmed, and I'm quite surprised at what can be achieved with the limitations set.

--
"Shame your mind don't shine like your possessions do" - Faithless (I want more part 1)

Anomie
Member #9,403
January 2008
avatar

You guys might find this interesting, if you haven't seen it before. A basic version of Tetris in one line of BASIC (six or seven screen-lines, though, when wrapped at 80 col).

Here's code, just cause it's fun to look at:

    0d=d:IFdVDUd:a=POINT(32*POS,31-VPOS<<5):RETURNELSEMODE9:GCOL-9:CLG:O
FF:d=9:REPEATVDU30:REPEATGOSUBFALSE:IFPOS=28VDUPOS,15,VPOS,24;11,26:IF0E
LSEIFa=0PRINT:UNTIL0ELSEUNTILVPOS=25:v=ABSRNDMOD7:i=0:VDU4895;3:REPEATm=
9-INKEY6MOD3:FORr=TRUETO1:t=rANDSGNt:IFt=rCOLOURv-15:VDUrEORm:i+=m=7AND9
-6*r:IF0ELSEFORn=0TO11:d=n/3OR2EORd:GOSUBFALSE:IF1<<(n+i)MOD12AND975AND&
C2590EC/8^vVDU2080*ABSr;:t+=a:IF0ELSENEXT,:VDU20:UNTILt*LOGm:UNTILVPOS=3

I like Matthew's a whole lot more (totally awesome), but that's as small as I've ever seen the basic gameplay represented.

______________
I am the Lorax. I speak for the trees. I speak for the trees for the trees have no tongues.

Matthew Leverton
Supreme Loser
January 1999
avatar

The clever part of Rheolism is how all seven shapes are encoded into a single 32-bit integer. If you can do that in a way that's easy to access, then the hard part is done.

I didn't try to do that because given 25 lines, it's not needed. For my final version, I just used a simple system:

0 1 2 3 
4 5 6 7
8 9 A B
C D E F

So the square would be 0x0145. This works nicely because it actually represents the offsets:

      y  x
0 => 00 00 => 0,0
1 => 00 01 => 0,1
4 => 01 00 => 1,0
5 => 01 01 => 1,1

When I need to test against a shape, I just read the right four bits as (y,x) then bit shift to get the next block.

Kikaru
Member #7,616
August 2006
avatar

Yes, I know my game doesn't work. No matter how hard I try, I can't get the collision code to register consistently.

Onewing
Member #6,152
August 2005
avatar

Alright, I gave it a shot. Unfortunately, I'm not elite enough, because my code fits in a 80x31. :-/ If I have time to cut out 400 characters somewhere, I might, but I probably won't as I have more important things to do. Still, doesn't mean I'm not going to do anything with the work I did (as it is a pretty solid game)! Wa-lah:

http://www.allegro.cc/files/attachment/595239

How to Play:
Water starts from the pipe on the green square. Place pipes without leaving any holes and connect a path to the blue square. You earn points for every second (more depending on which level you are on).

BUG Note: Make sure you don't have the cursor (red box) near where the water is filling. I becomes erratic and you will lose. :-/

Commands:
Arrows: Move the current pipe, red square shows position
Space Bar: Place the pipe at that point.
F Key: Hurry the water along (gives you extra points!)

The break in the code below is where I went over the limit.

1#include <allegro.h> /* Line Dreams by Onewing //////////////////////////////*/
2int st,ti;void t(){st++;}END_OF_FUNCTION(t);db(BITMAP *p){destroy_bitmap(p);}
3main(){allegro_init();set_color_depth(8);int bs=91,ex,ey,ft=0,go=0,h=200,c=15,i,
4it=0,j,l=0,next,sc=0,sct=0,sx,sy,w=300,wd,wt=0,wx,wy,x=0,y=0;BITMAP *g[10][10],
5*b=create_bitmap(bs,bs),*b2=create_bitmap(bs,bs),*b3=create_bitmap(w,h+10),*p[8]
6;srand(time(0));install_sound(-1,-1,0);install_keyboard();set_gfx_mode(GFX_GDI,w
7,h+10,0,0);for(i=0;i<8;i++){p<i>=create_bitmap(9,9);clear(p<i>);}line(p[1],4,0,4
8,9,c);BITMAP *cur=p[rand()%6+1],*n=p[rand()%6+1];line(p[2],0,4,9,4,c);line(p[3],
94,0,4,4,c);line(p[3],4,4,9,4,c);install_int_ex(t,BPS_TO_TIMER(60));for(i=1;i<4;
10i++)rotate_sprite(p[i+3],p[3],0,0,itofix(i*64));rectfill(p[7],0,0,9,9,3);while(!
11key[59]&&!go){for(i=0;i<10;i++)for(j=0;j<10;j++)g<i>[j]=p[0];for(i=0;i<l;i++){g[
12rand()%8+1][rand()%8+1]=p[7];g[rand()%8+1][rand()%8+1]=p[rand()%6+1];}sx=sy=ex=
13ey=1;while(sx!=0&&sy!=0){sx=rand()%9;sy=rand()%9;}while(ex!=9&&ey!=9){ex=rand()%
1410;ey=rand()%10;}wx=0;wy=0;if(sx==0){g[sx][sy]=p[2];wy=sy*9+4;}else{g[sx][sy]=p[
151];wx=sx*9+4;}if(ex==9)g[ex][ey]=p[2];else g[ex][ey]=p[1];wd=1000-(l*50);if(wd<
16200)wd=200;rectfill(b2,0,0,bs,bs,0);while(key[6]){}next=0;while(!key[59]&&!next)
17{while(st){st--;ti++;if(key[75]&&g[x][y]==p[0]){g[x][y]=cur;cur=n;n=p[rand()%6+1
18];}if(key[6]){wd=0;sc++;}if(ti-it>4){it=ti;if(x<9&&key[83])x++;if(x>0&&key[82])
19x--;if(y<9&&key[85])y++;if(y>0&&key[84])y--;}if(ti-sct>60){sct=ti;sc+=(l+1)*5;}
20if(ti-wt>wd){wd=35;wt=ti;if(getpixel(b,wx-1,wy)==15)wx--;else if(15==getpixel(b,
21wx+1,wy))wx++;else if(getpixel(b,wx,wy-1)==15)wy--;else if(getpixel(b,wx,wy+1)==
2215)wy++;else{if(wx>ex*9&&wx<ex*9+9&&wy>ey*9&&wy<ey*9+9)l++;else{textprintf(
23screen,font,10,90,15,"Fin! N: New, Q: Quit");while(!key[14]&&!key[17]){}if(key[
2414]){sc=0;l=0;ti=0;st=0;sct=0;}if(key[17])go=1;}next=1;}}}clear(b);clear(b3);
25rectfill(b,sx*9,sy*9,sx*9+8,sy*9+8,10);rectfill(b,ex*9,ey*9,ex*9+8,ey*9+8,1);for
26 
27(i=0;i<10;i++)for(j=0;j<10;j++)rect(b,i*9,j*9,i*9+9,j*9+9,3);rect(b,x*9,y*9,x*9+
289,y*9+9,4);draw_sprite(b,cur,x*9,y*9);for(i=0;i<10;i++)for(j=0;j<10;j++)
29draw_sprite(b,g<i>[j],i*9,j*9);putpixel(b2,wx,wy,1);draw_sprite(b,b2,0,0);
30textprintf_right(b3,font,w-20,0,14,"Lvl:%d Score:%d Next:",l+1,sc);draw_sprite(
31b3,n,w-15,0);stretch_blit(b,b3,0,0,bs,bs,0,10,w,h);blit(b3,screen,0,0,0,0,w,h+10
32);}}db(b);db(b2);db(b3);for(i=0;i<5;i++)db(p<i>);}END_OF_MAIN()

------------
Solo-Games.org | My Tech Blog: The Digital Helm

Frank Griffin
Member #7474
July 2006

The full size game I am writing is 11,000 lines of code now.
Seeing all of these 80x25 games makes my code feel bloated now hehe.
If I ever need to conserve space in future work, I will have to reference some of these small games.
The coding reminds me of optimized sorting routines and how they do so much with so little.

"gut feeling the people in England are poor" -Samuli
"taken out of context it's an awesome quote" - Jonatan Hedborg

kenmasters1976
Member #8,794
July 2007

Updated version. This is likely the last version of my Tetris and the end of my activity in this ScreenHack since I won't be writing another entry.

I did't feel like rewriting all the underlying code so I just patched it to have different colors, even though I'm not actually sure if it looks better or worse. Maybe it's just that I couldn't find a color combination that can be created on-the-fly and yet look good. Luckily I can revert it to the previous look by simply changing a few parameters.

Now the pieces fall slower and the velocity increases every 10 lines.

Also, hopefully all gameplay issues must be fixed now.

1#include <allegro.h> // SHTetris.c v.4
2#define f(i,x) for(i=0;i<x;i++) /////////////////
3#define B(x) PS(); stretch_blit(O,screen,0,0,128,200,0,0,256,400); rest(x)
4#define RF(a,b,c,w) rectfill(O,xo+a+j*8,yo+b+y*8,xo+a+j*8+w,yo+b+y*8+w,c)
5char ps[8][16]={0,15,0,0,2,2,2,2,0,15,0,0,2,2,2,2,2,2,3,0,7,4,0,0,3,1,1,0,1,7,0
6,0,1,1,3,0,4,7,0,0,3,2,2,0,7,1,0,0,1,3,2,0,6,3,0,0,1,3,2,0,6,3,0,0,2,3,1,0,3,6,
70,0,2,3,1,0,3,6,0,0,7,2,0,0,1,3,1,0,2,7,0,0,2,3,2,0,3,3,0,0,3,3,0,0,3,3,0,0,3,3
8,0,0};int F[25],cF[25][16],i,j,p,q=0,m[4],x,y,w,a=0,o,no=0,d,e,g,k,rt,rtl,cf,h,
9cm,rp,cr,xo,yo,l,S=0,tl=0,ll=0,P1=0xFFFF,is=64,cc=0x1FF4d4;BITMAP *O;UF(){l=0;f
10(i,24)if(F<i>==P1){l++;DL(i,-1,-1,-1,0);B(50);DL(i,-1,cc<<4,-1,0);B(50);}f(i,24
11)if(F<i>==P1)f(j,i){F[i-j]=F[i-j-1];memcpy(cF[i-j],cF[i-j-1],64);}S+=pow(l,2)*
121024;tl+=l;if((ll+=l)>=10){is-=is>6?4:0;ll-=10;}}DL(y,d,c,sc,u){f(j,16){if(u)cr
13=cF[y][j]?cF[y][j]:c;else cr=c;if(d&1<<j){RF(1,1,cr,6);RF(3,3,cr<<1,4);}else if
14(sc)RF(0,0,sc,8);}}PS(){textprintf_ex(O,font,17,0,-1,-1,"%10d",S);}C(h){cm=0;f(
15i,4){m<i>=ps[p][o*4+i];cm=cm||F[h-i]&m<i><<x;}return cm;}main(){allegro_init();
16F[24]=-1;set_color_depth(24);set_gfx_mode(2,256,400,0,0);install_keyboard();f(i
17,24)F<i>=0xF003;O=create_bitmap(128,200);srand(time(NULL));while(!key[59]){if(!
18a){p=q;q=rand()%7;o=no;no=rand()%4;d=0;a=1;x=6;y=3;w=6;}if(h>e){y++;h=0;}w=x;rp
19=o;if(key[83]||key[82]){rt++;if(rt>rtl){rt=0;x+=key[83]?1:-1;rtl/=2;if(rtl<4)
20rtl=4;}}if(key[75]&&!k){o=(o+1)%4;k=1;}if(!key[75])k=0;if(!key[83]&&!key[82]){
21rtl=32;rt=31;}if(key[85]){e=1;g=1;if(!d)S++;}if(!key[85]){e=is;g=48;}if(C(y-1))
22{x=w;o=rp;}if(!C(y)){d=0;h++;}else d++;if(d>g){f(i,4){F[y-i-1]|=m<i><<x;f(j,16)
23if(m<i><<x&1<<j)cF[y-i-1][j]=(p+1)*cc;}a=0;if(y<4){rest(999);exit(0);}}xo=yo=0;
24f(i,25)DL(i,F<i>,0xFFA6A6,99,1);f(i,4)DL(y-1-i,m<i><<x,(p+1)*cc,0,0);UF();xo=96
25;yo=72;f(i,4){m<i>=ps[q][no*4+i];DL(5-i,m<i>,0xFFF,0,0);}B(15);}}END_OF_MAIN()

{"name":"595251","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/6\/46723a2f8e48800a1482a96668210f46.gif","w":264,"h":433,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/6\/46723a2f8e48800a1482a96668210f46"}595251

Tomasz Grajewski
Member #4,284
February 2004

Very simple pong clone, in only 16 lines of code, but with collision bug:

1#include <allegro.h> // Ultra simple pong clone in only 16 lines of code - v1 //
2int rd(){return(rand()%2)?1:-1;}BITMAP*s;struct P{int x,y;static const int W=8,H
3=64;P(int _x):x(_x),y((480-H)/2){}void m(int d){y+=d;y=MAX(0,y);y=MIN(y,480-H-1)
4;}void d(){rect(s,x,y,x+W-1,y+H-1,4);}};struct B{int x,y,dx,dy;static const int
5S=8;B():x((640-S)/2),y((480-S)/2),dx(rd()),dy(rd()){}void idx(){dx*=-1;}void idy
6(){dy*=-1;}void m(){x+=dx;y+=dy;}void d(){rect(s,x,y,x+S-1,y+S-1,14);}};int cc(B
7&b,P&p){return!(b.y>p.y+P::H-1||b.y+B::S<p.y||b.x>p.x+P::W-1||b.x+B::S-1<p.x);}
8int e=1;void cbh(){e=0;}int main(){srand(time(0));allegro_init();install_keyboa\
9rd();set_close_button_callback(cbh);set_gfx_mode(2,640,480,0,0);s=create_bitmap(
10640,480);int ls=0,rs=0;P pl(0),pr(640-P::W);B b;while(e){if(key[59])e=0;if(key[
1123])pl.m(-1);if(key[19])pl.m(1);if(key[84])pr.m(-1);if(key[85])pr.m(1);b.m();if(
12b.x<=0||b.x+B::S-1>=640){b.idx();if(b.x<=0)rs++;else if(b.x+B::S-1>=640)ls++;}if
13(b.y<=0||b.y+B::S-1>=480)b.idy();if(cc(b,pl)||cc(b, pr))b.idx();clear_bitmap(s);
14pl.d();pr.d();b.d();textprintf_centre_ex(s,font,640/2,1,7,-1,"%5i : %-5i",ls,rs)
15;blit(s,screen,0,0,0,0,640,480);rest(10);}destroy_bitmap(s);return 0;}END_OF_MA\
16IN();///////////////////////////////////////////////////////////////////////////
17////////////////////////////////////////////////////////////////////////////////
18/////////W A S T E D///S P A C E////////////////////////////////////////////////
19////////////////////////////////////////////////////////////////////////////////
20////////////W A I T N G///T O///B E/////////////////////////////////////////////
21////////////////////////////////////////////////////////////////////////////////
22////////////////U S E D/////////////////////////////////////////////////////////
23////////////////////////////////////////////////////////////////////////////////
24////////////////////////////////////////////////////////////////////////////////
25////////////////////////////////////////////////////////////////////////////////

http://www.allegro.cc/files/attachment/595253

___________________________________________________________________________________________
mBlocks - a Tetris clone written in JavaScript | Merix Studio - website design & development | Zeitgeist

Per Larsson
Member #276
April 2000
avatar

Awesome entries, everyone. Especially the tetris games blow my mind :)

________________________
Guichan!

kenmasters1976
Member #8,794
July 2007

Tomasz Grajewski, the pads are barely visible and it takes a bit too long for the ball to go from one side to the other at that speed.

Tomasz Grajewski
Member #4,284
February 2004

Posting updated version:

  • faster gameplay (but still slow and easy)

  • pads and ball are better visible (I hope)

  • less code ;)

  • probably even more bugs to discover

1#include <allegro.h> // Ultra simple pong clone in only 14 lines of code - v2 //
2BITMAP*s;int e,ls,rs;struct P{int x,y;static const int W=8,H=64;P(int z){x=z;y=(
3480-H)/2;}void m(int d){y+=d;y=0>?y;y=y<?480-H-1;}void d(){rectfill(s,x,y,x+W-1,
4y+H-1,9);}}pl(0),pr(640-P::W);struct B{int x,y,dx,dy;static const int S=8;B(){x=
5(640-S)/2;y=(480-S)/2;dx=dy=2;}void idx(){dx*=-1;}void idy(){dy*=-1;}void m(){x
6+=dx;y+=dy;}void d(){rectfill(s,x,y,x+S-1,y+S-1,14);}}b;int cc(B&b,P&p){return!(
7b.y>p.y+P::H-1||b.y+B::S<p.y||b.x>p.x+P::W-1||b.x+B::S-1<p.x);}int main(){alleg\
8ro_init();install_keyboard();set_gfx_mode(1,640,480,0,0);s=create_bitmap(640,480
9);while(!e){if(key[59])e=1;if(key[23])pl.m(-2);if(key[19])pl.m(2);if(key[84])pr.
10m(-2);if(key[85])pr.m(2);b.m();if(b.x<1||b.x+B::S>640){b.idx();if(b.x<1)rs++;el\
11se if(b.x+B::S>640)ls++;}if(b.y<1||b.y+B::S>480)b.idy();if(cc(b,pl)||cc(b,pr))b.
12idx();clear_bitmap(s);rect(s,0,0,639,479,8);pl.d();pr.d();b.d();textprintf_cent\
13re_ex(s,font,319,4,7,-1,"%5i : %-5i",ls,rs);blit(s,screen,0,0,0,0,640,480);rest(
1410);}destroy_bitmap(s);return 0;}END_OF_MAIN();/////////////////////////////////
15////////////////////////////////////////////////////////////////////////////////
16/////////W A S T E D///S P A C E////////////////////////////////////////////////
17////////////////////////////////////////////////////////////////////////////////
18////////////W A I T I N G///T O///B E///////////////////////////////////////////
19////////////////////////////////////////////////////////////////////////////////
20////////////////U S E D/////////////////////////////////////////////////////////
21////////////////////////////////////////////////////////////////////////////////
22///////////////////B U T///I///H A V E///N O///I D E A S////////////////////////
23////////////////////////////////////////////////////////////////////////////////
24///////////////////////T O///I M P L E M E N T//////////////////////////////////
25////////////////////////////////////////////////////////////////////////////////

___________________________________________________________________________________________
mBlocks - a Tetris clone written in JavaScript | Merix Studio - website design & development | Zeitgeist

kenmasters1976
Member #8,794
July 2007

That's better indeed Tomasz Grajewski. Well done.

Onewing, it seems you can't move after pressing 'N' to start a new game.

Skywhy
Member #9,243
November 2007
avatar

Oh, what the hell? This thread is made of total awesomeness and win!

I totally suck in doing things like this, the compo really ain't for me but hell, it seems so much fun that I have to give it a shot :D No matter is it still on or not, this is just ... great! :o

There should be more stuff like this.

I already got this idea in my head for an game snicker
It's disturbing how awesome entries there are already. Doing fine guys, keep at it.

MiquelFire
Member #3,110
January 2003
avatar

Thread is still open, so this compo is still open. basically, if the thread gets closed, it's over, and voting will begin (I guess)

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

Paul Pridham
Member #250
April 2000
avatar

Keep it open! I want to do something for this, just haven't had time yet.

Skywhy
Member #9,243
November 2007
avatar

I already started mine yesterday at work, I just couldn't resist... :D

Got the basic idea going. Don't have the time to do this on saturday(today) but I'll wrap it up tomorrow(sunday) I guess...

Nomnom! Everybody polishing their entries or lost their interest already?

Seppl
Member #4,656
May 2004
avatar

Mika Turunen said:

Everybody polishing their entries or lost their interest already?

The second.

__________________________________
All you need is lunch - The Rutles

CGamesPlay
Member #2,559
July 2002
avatar

I actually sat down and worked on my old entry. I found a lot of places where I could save more space and I did add some basic syntax highlighting, but it wasn't really adding anything to the game :-/

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>



Go to: