0

I am currently incrementing float variables inside of the draw() method to alter the x and y coordinates of a Bitmap, although the results are quite choppy and you can see the jumps as it increments. Should I create a thread for incrementing the coordinates??

My code from the draw method:

   x += 2.5;
   y += 2.5;
   c.drawBitmap(image, x, y, p);
  c.drawBitmap(image, x - image.getWidth(), y, null);
  c.drawBitmap(image, x, y - image.getHeight(), null);
  c.drawBitmap(image, x - image.getWidth(), y - image.getHeight(), null);

But it seems either the animation is too slow or it is choppy. How do I alter my code so the animation will appear smooth at any "speed"??

Thank you in advance!

Miroslav Glamuzina
  • 4,472
  • 2
  • 19
  • 33

1 Answers1

0

Turned out I was using Canvas incorrectly. Was setting:

Canvas c = null;

instead of

Canvas c = new Canvas();
Miroslav Glamuzina
  • 4,472
  • 2
  • 19
  • 33