0

I am trying to use sprite batch to rotate a rectangle with a texture like so:

game.batch.draw(Image, (float)x, (float)y, (float)42.5, (float)33, (float)85, (float)66, (float)1, (float)1, (float)angleDegrees);

But i get the error:

The method draw(Texture, float, float, float, float, float, float, float, float) in the type SpriteBatch is not applicable for the arguments (Texture, float, float, float, float, float, float, float, float, float)

I think i have the right amount of parameters, and they are all floats, what am i missing.

user3165683
  • 347
  • 1
  • 9
  • 28
  • I cannot find that mathod signature in the documentation: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/SpriteBatch.html please which of these methods you are trying to call. – kajacx Jul 12 '14 at 11:14
  • @kajacx Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height. The rectangle is offset by originX, originY relative to the origin. Scale specifies the scaling factor by which the rectangle should be scaled around originX, originY. Rotation specifies the angle of counter clockwise rotation of the rectangle around originX, originY. Specified by: draw(...) in Batch Parameters: region x y originX originY width height scaleX scaleY rotation – user3165683 Jul 12 '14 at 11:20
  • 1
    @kajacx void com.badlogic.gdx.graphics.g2d.Batch.draw(TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation) – user3165683 Jul 12 '14 at 11:21
  • 1
    Ah, i didn't see that one because it requires a `TextureRegion` instead of a `Texture`, but they are not in subtype releationship, thus the error. Try converting your texture to `TextureRegion` then. – kajacx Jul 12 '14 at 14:00

1 Answers1

0

You do not have the right amount of parameters. You have one float too much. Thats how I would put it in an editor to see whats the problem by such a bunch of parameters.

The method draw(
Texture, float, float, float, float, float, float, float, float) 
in the type SpriteBatch is not applicable for the arguments (
Texture, float, float, float, float, float, float, float, float, **float**)
Zarathustra
  • 2,853
  • 4
  • 33
  • 62