public void handleIntersection() { TDir curDir = car.getDirection(); TileModel curTile = car.currTileOnMap(); if (curTile.isOpen(curDir.rightTurn())) { Log.v("BRAIN", "Turning right"); car.makeTurn(curDir.rightTurn()); } else if (curTile.isOpen(curDir)) { Log.v("BRAIN", "Continuing through intersection because cant turn right"); car.driveAlong(); } else if (curTile.isOpen(curDir.leftTurn())) { Log.v("BRAIN", "Turning left because can't go straight or right"); car.makeTurn(curDir.leftTurn()); } else { Log.v("BRAIN", "Stopping because there's nowhere to go"); car.comeToStop(); } }
@Override protected void onDraw(Canvas canvas) { canvas.drawColor(Color.WHITE); super.onDraw(canvas); if (getmBitmapIndex() == 0) { Paint tp = new Paint(); tp.setAlpha(200); canvas.drawBitmap(mEmptyBitmap, null, getmAreaRect(), tp); } }