Ezelia Posted March 6, 2014 Share Posted March 6, 2014 Hello community,here is my entry to 1kjs competition just a pong clone with a small twist. http://js1k.com/2014-dragons/demo/1770UP/DOWN to move, Forward to fire tiny dragons . Quote Link to comment Share on other sites More sharing options...
fel666 Posted March 9, 2014 Share Posted March 9, 2014 i like the idea, however, im not sure the game is quite finished. you should add some borders, so you can see when the ball will bounce, and maybe add mobile support? (it didn't seem like there was any to me) Quote Link to comment Share on other sites More sharing options...
Ezelia Posted March 10, 2014 Author Share Posted March 10, 2014 sure, the game is not finished at all ... but it's a 1K competition, all the code should fit in 1024 characters ... we can't do everything we want in too few space.here is what the code looks like e=b.onkeydown=function(a){e=a};b.onkeyup=function(a){e={}};f="fillStyle";j="#f00";k="#000";c.T=c.fillText;c.R=c.fillRect;R=Math.random;S=Math.abs;T=Math.sin;C=D=E=F=G=H=I=e=s2=s1=0;w=300;x=h=150;y=10;v=1;z=2;g=A=B=20;onresize(2*w,2*h);c.scale(2,2);setInterval("if(!H){if(W=e.which)A+=2*(W-39);39!=W||C?0:C=1;1==C?D=A+10:0;0<v&&x>80+200*R()&&(y<B+10?B-=2:B+=2);30>=S(D-&&0.8<R()&&(0>y-B?B-=2:B+=2);0.98<R()&&S(A-<g&&!E?E=w-1:0;E==w-1?F=B+10:0;8>x&&y>A&&y<A+g||x>w-9&&y>B&&y<B+g?v=-v:0;y>h||0>y?z=-z:0;C>w-6&&C<w&&D>B&&D<B+g?(x=w+1,G=6):0;2<E&&8>E&&F>A&&F<A+g?(x=-1,G=6):x;(H=0>x||x>w)?(setTimeout('H=0',2*w),C=E=0,I=G?0:4):0;0>x?s1++:x>w?s2++:0;x>w||0>x?x=h:0;0>A?A=0:A>h-g?A=h-g:0;x+=v;y+=z;C>w+4?C=0:0;C?(C+=2,D+=~~(4*T(x/5)))=-g;-4>E?E=0:0;E?(E-=2,F+=~~(4*T(x/5))):F=-g}c[f]=G%2?j:I%2?k:'#fff';c.R(0,0,w,h);c[f]=k;c.R(x,y,4,4);c.R(2,A,6,g);c.R(w-6,B,6,g);c[f]=j;c.R(C-3,D-2,6,4);c.R(C+3,D-4,2,2);c.R(C,D-4,2,2);c.R(E-3,F-2,6,4);c.R(E-6,F-4,2,2);c.R(E,F-4,2,2);c.T(s2,g,10);c.T(s1,w-g,10);G=0<G?G-1:0;I=0<I?I-1:0",16) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.