well i seem to have used the grabpixel to grab the pixels that i wanna check, but to say that there is some slow down would be an understatement, the game barely crawls!!
there must be a quicker way (bearing in mind im only using the pixel grabber to only grab pixels) of doing this, because the slow down is terrible!! - oh and it has to work with the microsoft virtual machine, not suns official virtual machine
heres the code that uses pixelgrabber, as you can see its only checking 3 pixels, but the slow down is so high, its unplayable
int return_value=0;
PixelGrabber pg=new PixelGrabber(offscreen,ball_X+15,ball_Y+33,3,1,pixels,0,3);
try{
pg.grabPixels();
}catch(InterruptedException e){}
test=createImage(new MemoryImageSource(3,1,pixels,0,3));
/*CHECK TO SEE IF BALL IS STALL ON THE PLAY AREA
*0=dead
*1=safe
*2=slow down
*3=speed up
*4=jump
*5=reverse
*6=finsih */
switch(pixels[0]){
//safe
case 0xff808080: return_value=1; break;
case 0xffc0c0c0: return_value=1; break;
//slow down
case 0xff800080: return 2;
case 0xffff00ff: return 2;
//speed up
case 0xff800000: return 3;
case 0xffff0000: return 3;
//jump
case 0xff000080: return 4;
case 0xff0000ff: return 4;
//reverse
case 0xff808000: return 5;
case 0xffffff00: return 5;
//finish
case 0xff008000: return 6;
case 0xff00ff00: return 6;
}
switch(pixels[2]){
//safe
case 0xff808080: return 1;
case 0xffc0c0c0: return 1;
//slow down
case 0xff800080: return 2;
case 0xffff00ff: return 2;
//speed up
case 0xff800000: return 3;
case 0xffff0000: return 3;
//jump
case 0xff000080: return 4;
case 0xff0000ff: return 4;
//reverse
case 0xff808000: return 5;
case 0xffffff00: return 5;
//finish
case 0xff008000: return 6;
case 0xff00ff00: return 6;
}
return return_value;
yeah, so its a bit of a ****** cos its JUST SO GOD **** SLOW!! (sorry i know i keep repeating myself, but its really fu***** me off!)