problem in TranslateAnimation

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

problem in TranslateAnimation

Postby sarangkulkarni17 » Thu Jul 02, 2009 3:51 pm

hello +-,
I am developing tank game,in which i have to show animation when bomb hits tank.
After hitting tank goes slowly downwards direction.
I used fallowing code
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.                 anim[t] = new TranslateAnimation(0,0,0,Math.abs(compTankY[t]-prevTankY[t]));//for moving tank downward up to        Math.abs(compTankY[t]-prevTankY[t])
  3.  
  4.                 anim[t].setInterpolator(new LinearInterpolator());
  5.  
  6.                 anim[t].setFillAfter(false);
  7.  
  8.                 anim[t].setDuration(1000);
  9.  
  10.                 anim[t].setAnimationListener(this);
  11.  
  12.                 anim[t].setFillEnabled(true);
  13.  
  14.                 computerTanks[t].setAnimation(anim[t]);
  15.  
  16.                 anim[t].start();
  17.  
  18. --------------------
  19.  
  20. ------------
  21.  
  22. public void onAnimationEnd(Animation animation) {
  23.  
  24.                 isAnimetion=false;
  25.  
  26.                 for(int i=0;i<COMPUTER_TANKS;i++)
  27.  
  28.                 {
  29.  
  30.                         computerTanks[i].layout(compTankX[i],compTankY[i],compTankX[i]+ Constants.tankWidth,
  31.  
  32.                                         compTankY[i]+Constants.tankHeight);
  33.  
  34.                 }
  35.  
  36.         }
  37.  
  38.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4

but it creating problem . In onAnimationEnd() i have set layout to all tanks.
sarangkulkarni17
Developer
Developer
 
Posts: 29
Joined: Fri Feb 13, 2009 10:00 am
Location: Pune

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 3 guests