package com.example.sampleasgl; import samodelkin.androidsimplestgamelibrary.LayerSprite; import samodelkin.androidsimplestgamelibrary.LayerTiles; import android.content.Context; import android.graphics.Canvas; import android.view.View; import android.graphics.*; public class GameView extends View { int x, y, x1, y1; private LayerSprite sprite; private LayerTiles map; private int[] indexMap={ 1,1,1, 1,0,1, 1,1,1 }; public GameView(Context context) { super(context); sprite=new LayerSprite(R.drawable.ic_launcher,this.getResources()); map=new LayerTiles(getResources(),new int[]{R.drawable.ic_launcher},indexMap, 3, 3); x = 10; y =10; x1 = 400; y1=10; } public void onDraw(Canvas c){ super.onDraw(c); map.paint(c); sprite.paint(c); map.setPosition(x,y); sprite.setPosition(x1,y1); x1--; if(map.collidesWith(sprite)){x--;} invalidate(); } }