Operations on multiple overlapping layers not working

Posted by Arun on Game Development See other posts from Game Development or by Arun
Published on 2011-04-28T06:57:02Z Indexed on 2011/06/27 16:33 UTC
Read the original article Hit count: 210

Filed under:

Hi I am developing a game in android just like Farmville by Zinga. In that game we have to place elements in the diamond shaped field so the don't overlap each other. Now I did coding for placing the field inside the farm field but I cannot stop the problem of overlapping of the farm field. I Am attaching the code that I have down for all this someone please help me....

try{
    if(bm1.getPixel((int)initX,(int)initY)!=0){
        if(bm1.getPixel((int)initX,(int)initY+20)!=0){
            if(bm1.getPixel((int)initX-20,(int)initY)!=0){
                if(bm1.getPixel((int)initX+20,(int)initY)!=0){
                    if(bm1.getPixel((int)initX,(int)initY-20)!=0){
                        c.drawBitmap(bm,initX-30,initY-20, paint);
                    }
                }
            }
        }
    }
}catch(Exception e) {
    Toast.makeText(getContext(), e.toString(), Toast.LENGTH_SHORT);
}

© Game Development or respective owner

Related posts about collision-detection