How to rotate four sprites to the focus of these sprites

I wrote the following code:

int a=0,b=0,c=0,d=0;
sprite[number[0]].setPosition(160,600);
        sprite[number[1]].setPosition(560,600);
        sprite[number[2]].setPosition(360,400);
        sprite[number[3]].setPosition(360,800);
        seiten[number[4]].setPosition(-35,0);
        seiten1[number[4]].setPosition(825,0);
        sprite[number[0]].setOrigin(200,0);
        sprite[number[1]].setOrigin(-200,0);
        sprite[number[2]].setOrigin(0,-200);
        sprite[number[3]].setOrigin(0,-200);
        sprite[number[0]].setRotation(a++);
        sprite[number[1]].setRotation(b++);
        sprite[number[2]].setRotation(c++);
        sprite[number[3]].setRotation(d++);

I want to rotate the sprite like:

Edit:

For a better understanding: I have ten different colors of elves, four of which are displayed on the game screen Coincidence determines which sprite will be displayed, but each of them has a different color Now I want to rotate the four sprites in the lane shown in the image These four sprites should turn on the pink Sprite, which doesn't actually exist in my code This pink sprite is just the symbol of the rotation center (P (360 | 600)) All four elves revolve in the same lane Using my code, the four sprites rotate but are not in the same lane shown in the image I hope my question is clearer now

Solution

I guess you can use sprite Rotate () and use sprite Setorigin () sets the origin of the sprite to the point you want to rotate

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>