thanks
it's a prototype for a glitched-out 2D shooter:
http://dl.dropbox.com/u/1358257/shooter/3d_prototype/applet/index.html
(browser needs to be in 32bit mode, and you have to trust it as it will load enemy sprites from flickr. there's not much gameplay in there.. but you can control avatar 1 with cursor keys, shoot with alt).
for the glitches:
Code:void pixelShifter()
{
loadPixels();
sincounter1 +=0.01;
sincounter2 +=0.005;
int bla = (int)(sin(sincounter1)*1000);
int bla2 = (int)(sin(sincounter1)*6);
counter = counter +counter;
if(counter > pixels.length) counter = 1;
for(int i = 0; i < pixels.length; i++){
if(i < pixels.length-bla2-width*2)
{
pixels[i] = pixels[i] | lastPixels[i+bla2+width*2]+bla;
}
lastPixels[i] = pixels[i];
}
updatePixels();
}
there's basically the pixel array which is there from beginning, and an array i called lastPixels as a temporary buffer. Each frame these arrays are mixed into each other, not directly on top but offset in a certain direction, determined by "bla2".
Code:pixels[i] = pixels[i] | lastPixels[i+bla2+width*2]+bla;
also there is some arbitrary number added to each pixel ("bla") and i don't know what exactly it does, but it totally messes up color
. bla and bla2 are controlled by sine waves, so the glitches are slowly changing direction...
it's fun to experiment with values in there but i have to say... i've seen the OS X curtain of Death quite a lot when running a sketch, probably doing something the gfx card does not want me to do.
the difficult thing imo is to gain actual control over glitches, i.e. changing intensity or location on screen...