My next #tweetcoding entry is Snake, a game which needs no introduction. No game here unfortuntely – just the control mechanism, but I believe this was the first entry to use keyboard input. Use W, A, S and D to control the snake… although due to the code I’ve used which interprets keyboard commands into horizontal and vertical velocities, other keys will also affect movement in unexpected ways. Here’s how it works:
The key codes for W and S (up and down) are 87 and 83, and the key codes for A and D (left and right) are 65 and 68. When a key is pressed, first I check if it is up/down, or left/right by testing whether its keycode is above 80 or not. If below, I subtract 66.5 from the key code, leaving either -1.5 or 1.5, which I use as the X velocity. If above 80, I subtract 85, leaving either -2 or 2, then multiply by .75 to ensure that the X and Y velocities match.
Of course, this means that other keys will also affect either the X or Y velocity at unpredictable speeds.

if(!i++){c=q=85;stage.addEventListener("keyDown",k)}function k(e){c=e.keyCode}v=h=0;c>80?v=(c-q)*.75:h=c-66.5;ls(9,i);lt(q-(x-=h),q-(y+=v))
Number 12 – my attempt at creating a shaded 3D cube cheats on two levels – 1: it’s not correct perspective 3D but isometric 3D, and 2: the “shading” is achieved with simple parallel lines which converge to mimic a shading effect as each plane turns away from the camera. The isometric effect is simple to produce – just scale the parent sprite/clip (in this case stage/root) by around 50%, and then rotate the children.

scaleY=.6;g.clear();x=275;y=130;i-=.03;for(q=x;q-=5;){j=m.cos(i)*y;k=s(i)*y;mt(k,j+q);ls(3);lt(-j,k+q);lt(-k,q-j);ls(1);lt(j,q-k);lt(k,j+q)}
Jellycube was a natural progression from my previous entry, but also inspired by Human Target by Melon Dezign. Melon’s style was always a big inspiration for my demogroup Reality, particularly with their de-emphasis on cutting-edge effects in favour of design and humour. However, once again I wasn’t able to achieve my desired outcome – instead of squashing & stretching the cube I was restricted to rotation only.

scaleY=
.4
;x=
275;for(j=
y=
160;j
-=
8;){if(!o
[j
]){o
[j
]=
addChild(new Bitmap(new BitmapData(y,y,1,8e8
)));o
[j
].y=j
*2}o
[j
].rotation=s
((j
+i
++)/999)*x}
My 14th, and final entry is Headless Flasher, an attempt at creating a stick figure running across the screen. This one was originally inspired by my cat Lucy, but it became pretty obvious that the 140 character limit wouldn’t allow four legs and a tail, so I switched over to a human stick figure. Unfortunately there was no room to add code for his head (or blood spurting out of his neck for that matter).

l=lt;scaleX=scaleY=-20;g.clear();j=s(i-=.2);k=s(i+1);x=x%650+3;y=(50+k)*6;ls(1);mt(2+j,k);l(1,4);l(2-j,-k);mt(1,4);l(0,7);l(1+j,5);l(j,4-j)