Пример #1
0
 public CreepDrawable(Creep creep, Bitmap creepImg, Bitmap deadCreepImg) {
   super();
   this.creep = creep;
   this.creepImg = creepImg;
   this.deadCreepImg = deadCreepImg;
   PointF center = creep.getHex().getCenter();
   this.imgTopLeft =
       new PointF(center.x - creepImg.getWidth() / 2.f, center.y - creepImg.getHeight() / 2.f);
 }
Пример #2
0
 @Override
 public void draw(Canvas canvas) {
   if (creep.isDead()) {
     canvas.drawBitmap(
         deadCreepImg,
         imgTopLeft.x + HexGrid.GLOBAL_OFFSET.x,
         imgTopLeft.y + HexGrid.GLOBAL_OFFSET.y,
         null);
   } else {
     canvas.drawBitmap(
         creepImg,
         imgTopLeft.x + HexGrid.GLOBAL_OFFSET.x,
         imgTopLeft.y + HexGrid.GLOBAL_OFFSET.y,
         null);
   }
 }
Пример #3
0
 /** Call this after the underlying creep moved and needs to be drawn somewhere else */
 public void updateLocation() {
   PointF center = creep.getHex().getCenter();
   this.imgTopLeft =
       new PointF(center.x - creepImg.getWidth() / 2.f, center.y - creepImg.getHeight() / 2.f);
 }