2014-12-18 89 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。 –