开发者

How to drag sprite on WP7 with XNA?

开发者 https://www.devze.com 2023-03-21 14:37 出处:网络
I can\'t find any information, h开发者_运维技巧ow should I create draggable (by touch events) sprite on WP7, can you show me how is it possible to do?You\'ll have to manually redraw it based on touch

I can't find any information, h开发者_运维技巧ow should I create draggable (by touch events) sprite on WP7, can you show me how is it possible to do?


You'll have to manually redraw it based on touch changes.

The logic should be something like:

-- When touch is detected on top of the item to move.
-- Until a touch is not detected on top of the item to move.
---- Update the position you want to display the item at relative to the new touch position.
---- Redraw page.


You can use the built in gestures in xna if you want. Use the FreeDrag one and use the delta of that to move the object accordingly. If you want it to flick and keep moving after someone releases, you can use the flick gesture.

0

精彩评论

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