i am trying to show bullets when the user touched the screen
i am making the bullet here
public Projectile(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
paint = new Paint();
bulletBitmap = BitmapFactory.decodeResource(context.getResources(),
R.drawable.bullet);
}
public interface ProjectileListener {
public void onProjectileChanged(float delta, float angle);
}
public void setProjectileListener(ProjectileListener l) {
listener = l;
}
public void setProjectileDirection(int x, int y, int size){
pos = new Rect(x, y, size, size);
invalidate();
}
protected void onDraw(Canvas c) {
c.drawBitmap(bulletBitmap, pos, pos, paint);
super.onDraw(c);
}
and call it here
Projectile p = new Projectile(TowerAnimation.this);
p.setProjectileDirection(x, y, 50);
projectiles.add(p);
Canvas c = null;
p.onDraw(c);
however i am getting errors on this line
c.drawBitmap(bulletBitmap, pos, pos, paint);
did i make anything wrong with the drawBitmap?
thanks