/*    */   public Grenade(float x, float y, int targetX, int targetY, int damage)
/*    */   {
/* 16 */     this.x = x;
/* 17 */     this.y = y;
/* 18 */     this.targetX = targetX;
/* 19 */     this.targetY = targetY;
/* 20 */     this.damage = damage;
/* 21 */     this.timer = 0;
/* 22 */     this.duration = 2000;
/* 23 */     this.active = true;
/* 24 */     this.visible = true;
/*    */ 
/* 26 */     float diffX = Math.abs(targetX - x);
/* 27 */     float diffY = Math.abs(targetY - y);
/* 28 */     float totalXY = diffX + diffY;
/*    */ 
/* 30 */     if (diffX >= diffY) {
/* 31 */       this.xPercent = (diffX / totalXY);
/* 32 */       this.yPercent = (1.0F - this.xPercent);
/*    */     } else {
/* 34 */       this.yPercent = (diffY / totalXY);
/* 35 */       this.xPercent = (1.0F - this.yPercent);
/*    */     }
/*    */ 
/* 39 */     this.speedX = (this.xPercent * this.speed);
/* 40 */     this.speedY = (this.yPercent * this.speed);
/*    */ 
/* 42 */     if ((x < targetX) && (y > targetY)) {
/* 43 */       this.speedY *= -1.0F;
/*    */     }
/* 45 */     if ((x > targetX) && (y < targetY)) {
/* 46 */       this.speedX *= -1.0F;
/*    */     }
/* 48 */     if ((x > targetX) && (y > targetY)) {
/* 49 */       this.speedX *= -1.0F;
/* 50 */       this.speedY *= -1.0F;
/*    */     }
/*    */ 
/* 53 */     this.image = Core.grenade.getTileImage(0);
/*    */   }