hey guys.

how do you fix the position of an image drawn onto a canvas with a
large scrollable background?

picture this: the background image is that of a room, the object
images are bed, door etc. the object images are drawn on top of the
background.

when i scroll the background, the objects should move with respect to
the background image, correct? the problem is the object images also
move but the position doesn't stay the same, i.e they shift from their
original positions.

here is my implementation.

switch (event.getAction()) {

case MotionEvent.ACTION_DOWN:
    mStartX = event.getRawX();
    mStartY = event.getRawY();
    break;
case MotionEvent.ACTION_MOVE:
    float x = event.getRawX();
    float y = event.getRawY();
    // Calculate move update.
    mScrollByX = x - mStartX; // move update x increment
    mScrollByY = y - mStartY; // move update y increment

    mBed.setX((mBed.getX() + mScrollByX));
    mBed.setY((mBed.getY() + mScrollByY));

is this correct? please help me out

thanx

\m/

-- 
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