How to animate transition from current position? - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: How to animate transition from current position? (/thread-1463.html)
How to animate transition from current position? - jeonghyunhan - Apr 12, 2009 08:50 PM
EDIT: I meant: How to "translate" from current position?
I've been trying to figure out how to translate a UIImageView from its current position since the current position keeps changing in my app.
I have a tile map, let's say 10x10 with a tile size of 32.
I have four directional swipes: left, right, up, and down each which causes a moveLeft, moveRight, moveUp, and moveDown function.
Each one of those functions has the following code:
This code ONLY works after the first initial animation.
If I were to swipe in any direction, the block would go to some random (not really, more like unintentional) tile.
If I swipe AGAIN it starts moving from tile to tile like I want it to but the problem is the FIRST translation.
I've just begun using animations so bare with me please.
I also thought of using:
CGAffineTransform transform = CGAffineTransformMakeTranslation(blah blah, blah blah);
CGAffineTransform transform2 = CGAffineTransformTranslate(transform, blah blah, blah blah);
But it's doing a lot of unexpected things (for me that is).
Is there a way to translate a UIImageView from its currentPosition for my purpose?