2014-12-18 91 views

回答

0

,想到的第一件事就是,如果我明白你的问题,你告诉所有的精灵在哪里,必须使用旋转点: sprite.setOrigin(yourPointVector2.x, yourPointVector2.y); sprite.rotation(yourRotation);

编辑新编辑的评论

1个精灵旋转的简单测试,可能不是最好的方法,但它现在发生在我身上。 enter image description here 就像这可以帮助你,如果你的精灵是50.50,则您的地图,并在地图的中心是400,240,我想创建一个将存储精灵的初始位置的变量,

例如:

//is stored only once, because if not will store where you are during rotation 

yourVectorPosInicial.x = sprite.getX(); 
yourVectorPosInicial.v = sprite.getY(); 

yourVectorCenterMap.x = 400f; 
yourVectorCenterMap.y = 240f;` 

youtSprite.setOrigin(yourVectorCenterMap.x-yourVectorPosInicial.x , 
        yourVectorCenterMap.y-yourVectorPosInicial.y); 

//this in your Draw or update render 

sprite.rotation(10f); 
+0

唯一的问题是,setOrigin相对于精灵的坐标,而不是屏幕 –

+0

@ SK-io的添加信息的评论, –

+0

谢谢,我会尝试你的编辑tomorow。 –