What the title says basically. I'm making a new object in my Game (the image on the far left: http://ift.tt/1wfkLFJ) and want to make it rotate 180 degrees about the top like a pendulum.
For some reason it just flickers really fast and I haven't been able to find a way to do this. Any ideas? The javadoc of the rotate method:
Sets the sprite's rotation in degrees relative to the current rotation. Rotation is centered on the origin set in setOrigin(float, float)
public class SwingingSpikes extends GameObject {
...
public SwingingSpikes(float xPos, float yPos) {
swingingSpikesTexture = new Texture("spikePendulum.png");
sprite = new Sprite(swingingSpikesTexture);
// Set the origin of the sprite
sprite.setOrigin(xPos + sprite.getWidth() / 2,
yPos + sprite.getHeight() / 2);
}
public void update() {
// Constantly rotate the sprite by 180 degrees
sprite.rotate(180);
}
...
}
Aucun commentaire:
Enregistrer un commentaire