Animated Bitmap Objects - PatrickLuhmann/Modron_Monodrone GitHub Wiki

This is a sample that displays several different objects on the screen. Each is animated and has an independent velocity. They all use the same bitmap.

Possible Enhancements

  • Different bitmaps
  • Bouncing off walls
  • Bouncing off each other
  • Tap to add object
  • Tap to delete object

Design Notes

A class called MyObject has been created to represent an object being displayed on the screen. It has a position and a velocity, along with methods to update the position and to draw it to a canvas. The bitmap can be scaled.

The display method should simply go through the list of objects, update the position, and draw. At the moment, there are simply two explicit variables.

If an object reaches the edge of the screen, it is moved to the opposite edge and it continues moving.

Velocity is tricky because of the different screen resolutions that are available.