How to move images both clockwise and counter with swipes?
Hello and thanks for the help,
I have images in all four corners of my screen. Swipe right and all images
rotate clockwise one corner. Swipe left all images move one corner
counter-clockwise. Everthing works fine so long as I all objects start
from their original position...so you have to swipe 4 times to get back to
original position and then swipe left and all is well. However, I would
like the user to have the ability to swipe back whenever they like not
just from original position.
My question: what is the best way to go about this ?
hope that made sense. thanks for reading
Code for my Xvalues stored in an Array....same idea for my yVales also
called getNewYvalue(). Called by swipeRight()
public void getNewXvalue()
{
int BLTL_XValues[] =
{145,135,126,117,110,103,98,93,89,86,83,81,80,80,80,80,81,83,85,88,91,95,99,104,109,115,122,129,137,146,156};
int BRBL_XValues[] =
{643,627,610,594,577,560,543,526,509,492,475,458,441,424,407,390,373,356,339,323,306,289,272,255,238,221,204,187,170,153,136};
int TLTR_XValues[] =
{137,151,167,183,199,216,232,249,266,282,299,316,333,349,366,383,400,417,433,450,467,484,500,517,534,551,568,584,601,618,634};
int TRBR_XValues[] =
{634,644,651,657,661,665,668,670,672,673,674,674,674,674,673,672,671,670,668,666,663,660,657,653,649,645,640,634,628,621,613};
for (int i = 0; i < TRBR_XValues.length; i++)
{
try {
Thread.sleep(50);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
goLeftX=BRBL_XValues[i];
goUpX=BLTL_XValues[i];
goDownX=TRBR_XValues[i];
goRightX=TLTR_XValues[i];
//
if(numOfSwipes==1)
{
droidSilverCell.setX(goUpX);
droidCards.setX(goLeftX);
droidCookies.setX(goDownX);
droidBlueCell.setX(goRightX);
}
else if(numOfSwipes==2)
{
droidSilverCell.setX(goRightX);
droidCards.setX(goUpX);
droidCookies.setX(goLeftX);
droidBlueCell.setX(goDownX);
}
else if(numOfSwipes==3)
{
droidSilverCell.setX(goDownX);
droidCards.setX(goRightX);
droidCookies.setX(goUpX);
droidBlueCell.setX(goLeftX);
}
else if(numOfSwipes==4)
{
droidSilverCell.setX(goLeftX);
droidCards.setX(goDownX);
droidCookies.setX(goRightX);
droidBlueCell.setX(goUpX);
}
else
{
}
if(numOfSwipes ==5)
{
numOfSwipes=1;
}
}
}
No comments:
Post a Comment