开发者

stretching and rotating of image in between of points in cocos2d

I have an arrow image. I want to stretch this image between of two points. I am retriving points from touch location so it i snot fixed. When user will touch on iPad arrow image will be appear and arrow image will be shown until the touch end appear.So 开发者_JAVA百科if user touches on point A and it is moving to Point B arrow image will be stretched upto Point B and so on.

How will I stretch image within points?


Your two touches will end up defining a box, and you will have a vector from point 1 to point 2. I suggest calculating the x and y delta (length) and from that you can figure a scale factor for your arrow image.

Now that you have the size of the sprite, you can calculate the angle of rotation of the sprite.

and finally, calculate the center point between point A and B and that will be where you place the sprite.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜