public int calcSprite(int x, int y, int bgIndex) {
    	
   // 	System.out.println("Sprite calc:" + x + " , " + y);
    	
        for (int i = 0; i < 8; i++) {
            int yVal = 1 + spriteScanline[i * 4] & 0xFF;
            int offY = y - yVal;
            int xVal = spriteScanline[i * 4 + 3] & 0xFF;
            int offX = x - xVal;
            if (offX < 0 || offY < 0 || offX >= 8 || offY >= getSpriteSize()) {
                continue;
            }
            int val = getSpritePixelIndexDirect(false, i, offX, offY, x, y, bgIndex, true);
            if(val != 0){
                return val;
            }
//            return getSpritePixelIndexDirect(false, i, offX, offY, x, y, bgIndex, true);
        }
        return 0;
    }