按顺时针旋转图片使用LibGDX顺时针、图片、LibGDX

2023-09-13 01:38:50 作者:盗梦者!

我们如何可以旋转图像顺时针使用LibGDX?我在找是当图像加载,假设一个明星,我需要从屏幕到屏幕年底的水平开始旋转,与星旋转,我怎么能做到这一点在libgdx?

How can we rotate a Image Clockwise using LibGDX? what i am looking is when a image is loaded,suppose a star, i need to rotate it from beginning of screen to end of the screen horizontally, with star rotating,how can i do that in libgdx?

推荐答案

在画的纹理与你的SpriteBatch,你可以使用的抽奖功能,包括旋转之一。这Javadoc开始所有的抽奖功能:SpriteBatch

When you draw the Texture with your SpriteBatch, you can use one of the draw functions that includes rotation. This javadoc has all the draw functions: SpriteBatch

您可以保留一个变量的位置和旋转,每次渲染,使其在移动时水平旋转增加位置的旋转和x分量。

You can keep a variable for position and rotation, and increase the rotation and x component of the position each time you render to make it rotate while moving horizontally.