Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use Array index in Ludo board
    primarykey
    data
    text
    <p>I just want to translate an image(Tokens) from bottom to top, left to right in <strong>Ludo board</strong> using animation. For this I have taken <strong>coordinates</strong> of every ImageView from where every token (red, blue, yellow, green colors) will move, but now I am stuck; what should i do next? I'm new to Android animation. How could I do that?</p> <p>This is my Array Index code:</p> <pre><code>public void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); setContentView( R.layout.start ); double aPowersOfTwo[] = new double[60]; aPowersOfTwo[0]=Math.pow(81,263); aPowersOfTwo[1]=Math.pow(50,262); aPowersOfTwo[2]=Math.pow(50,231); aPowersOfTwo[3]=Math.pow(80,227); } </code></pre> <p>my java code for yellow token is</p> <pre><code>switch(rand.nextInt(6) + 1) { case 1: diceImage.setImageResource(R.drawable.dice_one); yellowToken.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()){ case R.id.yellow_token9: Animation animation = new TranslateAnimation(0,80,0,48); animation.setDuration(1500); animation.setFillAfter(true); yellowToken.startAnimation(animation); yellowToken.setVisibility(0); break; } }}); case 2: diceImage.setImageResource(R.drawable.dice_two); Log.d("dice", "2"); break; case 3: diceImage.setImageResource(R.drawable.dice_three); Log.d("dice", "3"); break; case 4: diceImage.setImageResource(R.drawable.dice_four); Log.d("dice", "4"); break; case 5: diceImage.setImageResource(R.drawable.dice_five); Log.d("dice", "5"); break; case 6: diceImage.setImageResource(R.drawable.dice_six); yellowToken.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()){ case R.id.yellow_token9: Animation animation = new TranslateAnimation(0,80,0,48); animation.setDuration(1500); animation.setFillAfter(true); yellowToken.startAnimation(animation); yellowToken.setVisibility(0); break; } }}); </code></pre> <p>and my xml code is</p> <pre><code>&lt;ImageView android:id="@+id/yellow_token9" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="45dp" android:layout_marginTop="222dp" android:clickable="true" android:background="@drawable/yellow"/&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload