如何编程来检测android中的两个位图冲突?

时间:2014-03-03 08:39:35

标签: android bitmap

Bitmap test =  BitmapFactory.decodeResource(getResources(), R.drawable.image2);
Bitmap mybitmap =  BitmapFactory.decodeResource(getResources(), R.drawable.sky);
Bitmap cloudy3 =  BitmapFactory.decodeResource(getResources(), R.drawable.cloud3);
Bitmap cloudy4 =  BitmapFactory.decodeResource(getResources(), R.drawable.cloud4);

while (isRunning) {

    try {
        Thread.sleep(20);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        }

    if (!ourHolder.getSurface().isValid())
        continue;
    Canvas canvas = ourHolder.lockCanvas();
    canvas.drawBitmap(mybitmap, 0, 0, null);
    canvas.drawBitmap(cloudy3, 30, 40, null);
    canvas.drawBitmap(cloudy4, 100, 150, null);
    if( x !=0 && y !=0){
            canvas.drawBitmap(test,birdX, birdY, null);
        birdY = birdY + 4;  

    }
    if(here i want condition to detect collison of bimaps){
        Intent i = new Intent("com.SystemX.birdfly.GAMEOVER");
        startActivity(i);

    }

0 个答案:

没有答案