I tried changing gameView a bit, but I still can't get it to work...
gameView:
package com.gravitygamesinteractive.mysticmaze;
import android.view.*;
import android.content.*;
import android.graphics.*;
import javax.security.auth.callback.*;
import android.view.SurfaceHolder.Callback;
import java.util.*;
import java.io.File;
public class gameView extends SurfaceView
{
private Bitmap bmp;
private Bitmap tilebmp;
private SurfaceHolder holder;
private GameLoopThread gameLoopThread;
private Sprite sprite;
private List<Tile> tiles=new ArrayList<Tile>();
private ArrayList<String> tilexarray=new ArrayList<String>();
private ArrayList<String> tileyarray=new ArrayList<String>();
private ArrayList<String> tileidarray=new ArrayList<String>();
private Scanner tilescan;
private int tileobjid;
private int tilex;
private int tiley;
private String tileobjidstr;
private String tilexstr;
private String tileystr;
private int b=0;
private int ta=0;
public gameView(Context context){
super(context);
gameLoopThread=new GameLoopThread(this);
holder=getHolder();
holder.addCallback(new Callback() {
@Override
public void surfaceDestroyed(SurfaceHolder holder){
gameLoopThread.setRunning(false);
gameLoopThread.stop();
}
@Override
public void surfaceCreated(SurfaceHolder holder){
gameLoopThread.setRunning(true);
gameLoopThread.start();
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height){
}
});
bmp=BitmapFactory.decodeResource(getResources(), R.drawable.kyle);
sprite=new Sprite(this,bmp);
levelFile();
tilebmp=BitmapFactory.decodeResource(getResources(), R.drawable.ttile);
for(ta=0; ta<tilexarray.size(); ta++){
tiles.add(createTile(R.drawable.ttile));
}
}
private Tile createTile(int resource){
Bitmap tilebmp=BitmapFactory.decodeResource(getResources(),resource);
return new Tile(this,tilebmp,Integer.parseInt(tilexarray.get(ta)),Integer.parseInt(tileyarray.get(ta)));
}
@Override
protected void onDraw(Canvas canvas){
canvas.drawColor(Color.BLACK);
sprite.onDraw(canvas);
for (int tac=0;tac<tilexarray.size();tac++){
Tile tile=new Tile(tilebmp,10,40);
tile.onDraw(canvas);
}
}
public void levelFile(){
try{
tilescan=new Scanner(new File("assets//levels//w1-1.txt"));
b=0;
while(tilescan.hasNextLine()){
tilex=tilescan.nextInt();
tilexstr=Integer.toString(tilex);
tilexarray.add(b,tilexstr);
tiley=tilescan.nextInt();
tileystr=Integer.toString(tiley);
tileyarray.add(b,tileystr);
b++;
}
}catch(Exception e){}
}
public ArrayList getTarrx(){
return tilexarray;
}
public ArrayList getTarry(){
return tileyarray;
}
}
Tile:
package com.gravitygamesinteractive.mysticmaze;
import android.graphics.*;
public class Tile
{
private int x;
private int y;
private gameView gameview;
private Bitmap bmp;
private int altx;
private int alty;
public Tile(gameView gameview, Bitmap bmp, int x, int y){
this.gameview=gameview;
this.bmp=bmp;
this.x=x;
this.y=y;
altx=x;
alty=y;
}
private void update(){
}
public void onDraw(Canvas canvas){
update();
canvas.drawBitmap(bmp,x,y,null);
}
}
and here's the error I keep getting:
Constructor 'com.gravitygamesinteractive.mysticmaze.Tile.Tile( com.gravitygamesinteractive.mysticmaze.gameView,an droid.graphics.Bitmap,int,int)' can not be applied to '(android.graphics.Bitmap,int,int)'