Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have have a rotation problem in the Slick2d library, the image is just not rotating (ie I set a rotation but no result is shown). Here is the rotation code:

if (input.IsKeyDown(Input.KEY_LEFT))  {
    velocity.x = -1;

    rotation = (float)Math.toRadians(180);

That is meant to set the rotation of image to 180 degress.

Then I render the image with an origin of the center of the image:

image.setCenterOfRotation(image.getWidth() * scale / 2, image.getHeight() * scale * / 2);

image.draw(position.x, position.y, scale);

Any ideas? Thanks.

share|improve this question
Are you trying to rotate the image over time or just set the rotation once when you're moving left? Because at best you're doing the latter right now. – Tetrad Feb 21 '12 at 7:33
Rotate the image when you move left, so when you hit the left button the image is meant to rotate 180 degress instantly. Which isn't working. – Darestium Feb 21 '12 at 8:24
As far as I know, Image.setRotation(float) accepts degrees, not radians. – Bobby Feb 21 '12 at 8:48
Thanks! Works :) – Darestium Feb 21 '12 at 8:52
up vote 0 down vote accepted

As far as I know, Image.setRotation(float) accepts degrees, not radians. Bobby.

Thanks Bobby!

share|improve this answer
Oh dear...I just confused Radians with Grads, otherwise I'd have posted that as answer anyway. :/ – Bobby Feb 21 '12 at 9:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.