With the Ladybug app, change a digital ladybug's look and path while it crawls.
The ladybug might resemble a real two-spotted ladybug found in hibiscus hedges growing near Havana's Fifth Avenue.
Put your finger on its path. If it reaches your finger, it will turn. Put your finger on it, and it will stop until you take your finger off it.
Pick a level using the Options Menu to select how to change the ladybug's look. Tap targets (which may look like paint bubbles) to activate or deactivate them. When the ladybug touches an active target, it will change.
The Ladybug app is in beta testing in Google Play, where you may access it at https://play.google.com/apps/testing/com.nelybehar.warrior.ladybug
Its code is in a private repository, available for discussion upon request.
Please contact me using my resume contact details or LinkedIn.
The Ladybug app (or Ladybug for short) uses Android Animator to mimic a beetle’s walk. With trigonometry, Ladybug calculates angles and distances for the animators. It coordinates animator sequences using callbacks and ladybug state.
To offload work from the UI thread, AsyncTask calculates the animation parameters.
Ladybug draws itself using Android’s drawing operations. Future updates may include shading using vector drawables to add 3D effects.
A Handler maintains the refresh rate of the draw operations by using sendMessageDelayed within handleMessage..
Ladybug uses MotionEvent to detect user finger motion on the screen.
It uses pixel collision detection to interact with the finger and targets.
The State design pattern manages the game levels; the Template design pattern defines similar logic across levels; the Factory Method design pattern instantiates the levels; the Observer design pattern allows the view and the main activity to communicate.
To offload work from the UI thread, a separate thread sends messages to the UI thread using a Handler, telling the UI thread what targets to display when.
The ladybug and target classes are extensible to create families of ladybugs and targets for future app updates.
The game uses randomness to make the ladybug move more naturally and to vary the location, timing, and order of target features. For example, the targets appear in random locations within pre-set boundaries; the targets in Level “Neon” appear and disappear at random times (using probabilities) and in random order.