Hello,

I'm writting a small game but I've a BIG problem.
I've a picture where I set animation. The pic goes down and up on
screen. When I click on this pic I would like retrieve his position
but.

When I create the object, it's placed at 0,0...
When it goes down, if I click on it nothing happens. If I click on the
original position, I retrieve my position but it's still 0,0, even if
my pic is on the bottom of the screen!

Find below a part of my code
Animation rootSet = new AnimationSet(true);
                rootSet.setInterpolator(new AccelerateInterpolator());
                rootSet.setRepeatCount(Animation.INFINITE);
                rootSet.setRepeatMode(Animation.INFINITE);
                float positionYStart = 0;
                int timing = 0;

                while (positionYStart<maxHeight) {
                        // Create and add first child, a motion animation.
                                TranslateAnimation transRight = new 
TranslateAnimation(0,15, 0,
15);
                                transRight.setStartOffset(timing);
                                transRight.setFillAfter(true);
                                transRight.setDuration(speedUp);
                                rootSet.addAnimation(transRight);

                                TranslateAnimation transLeft = new 
TranslateAnimation(0,-15, 0,
15);
                                transLeft.setStartOffset(timing+speedUp);
                                transLeft.setDuration(speedUp);
                                transRight.setFillAfter(true);
                                rootSet.addAnimation(transLeft);

                                timing = timing+speedUp*2;
                                positionYStart = positionYStart+30;
                        }
                this.setAnimation(rootSet);
                this.startAnimation(rootSet);

This a class extended ImageView

public MyClass(Drawable d, Context c, int screenWidth){
                super(c);

                setImageDrawable(d);
                setBackgroundColor(Color.GRAY);
                super.setFrame(new Random().nextInt(screenWidth), 0, 30,30);
                setLayoutParams(new
LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
        }

Thanks for your help
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to