Why doesn't the bitmap moves?
public void onDraw(Canvas canvas){
SetAng();
setPos();
bullets = new ArrayList<Shot2>();
Shot2 oi = new Shot2(angulo, angulo2, posyE, posyE);
bullets.add(oi);
for(int c = 0; c < bullets.size(); c++){
s2 = (Shot2) bullets.get(c);
s2.onDraw(canvas);
}
Matrix mtx2 = new Matrix();
mtx2.reset();
/*Random rand3 = new Random();
shotif = rand3.nextInt(2);*/
badNave = BitmapFactory.decodeResource(getResources(),R.drawable.nave2);
nv2w = badNave.getWidth();
nv2h = badNave.getHeight();
mtx2.setRotate(angulo, posxE + (badNave.getWidth()/2), posyE + (badNave.getHeight()/2));
canvas.setMatrix(mtx2);
canvas.drawBitmap(badNave, posxE, posyE, null);
canvas.setMatrix(null);
}
public float getbadNaveW(){
return nv2w;
}
public float getbadNaveH(){
return nv2h;
}
}
public class Shot2{
Enimigos enm;
float rw2, rh2, ox2, oy2, xshot2, yshot2;
public Shot2(float angrot, float ang, float incx, float incy){
if(angshot2 == 0 && xshot2 == 0 && yshot2 == 0 && vxS2 == 0 && vyS2 == 0){
angshot2 = (float) Math.toDegrees(ang);
angshotrot2 = angrot;
ox2 = incx;
oy2 = incy;
}
}
public void setPosShot(){
vxS2 = (float) (Math.cos(angshot2))*6;
vyS2 = (float) (Math.sin(angshot2))*6;
if(xshot2 == 0 && yshot2 == 0 && vxS2 == 0 && vyS2 == 0){
xshot2 = ox2 + (enm.getbadNaveW()/2) - (getRectW()/2);
yshot2 = oy2 + (enm.getbadNaveH()/2) - (getRectH()/2);
}else{
xshot2 += vxS2;
yshot2 += vyS2;
}
}
public void onDraw(Canvas canvas){
setPosShot();
Matrix mtx3 = new Matrix();
mtx3.reset();
rect2 = BitmapFactory.decodeResource(getResources(),R.drawable.rect2);
rw2 = rect2.getWidth();
rh2 = rect2.getHeight();
mtx3.setRotate(angshotrot2, xshot2 + (rw2/2), yshot2 + (rh2/2));
canvas.setMatrix(mtx3);
canvas.drawBitmap(rect2, xshot2, yshot2, null);
canvas.setMatrix(null);
}
public float getRectW(){
return rw2;
}
public float getRectH(){
return rh2;
}
}




