java - Angle facing other way libgdx -


i figured out convertion of x , y of cursor angle problem sprite facing oposite direction.

here code

@override     public void create() {         bida = new texture(gdx.files.internal("data/alienblaster.png"));           tr = new textureregion(bida);          bucket = new rectangle();         bucket.x = 800 / 2 - bida.getwidth() / 2; // center bucket horizontally         bucket.y = 400/2;         /*bucket.x = gdx.graphics.getwidth() - bida.getwidth();         bucket.y = gdx.graphics.getheight() - bida.getheight();*/         bucket.width = bida.getwidth();         bucket.height = bida.getheight();          bullets = new array<rectangle>();         spawnraindrop();          camera = new orthographiccamera();         camera.settoortho(true, 800, 480);          front = 270;           batch = new spritebatch();         gdx.input.setinputprocessor(this);      }    @override     public void render() {         gdx.gl.glclearcolor(1, 1, 1, 1);         gdx.gl.glclear(gl10.gl_color_buffer_bit);          camera.update();          batch.setprojectionmatrix(camera.combined);          batch.begin();         {             //batch.draw(bida,bucket.x,bucket.y, 50,50);              batch.draw(tr, bucket.x, bucket.y, bucket.getwidth()/2 /*center x of image rotate*/, bucket.getheight()/2 /*center y of image rotate*/, bucket.getwidth() , bida.getheight(), 1, 1, front);         }         batch.end(); }    @override     public boolean mousemoved(int screenx, int screeny) {          float dx = screenx - bucket.x; // cursor x , sprite x coordinates         float dy = screeny - bucket.y; // cursor y , sprite y coordinates         float secondsolution =mathutils.radianstodegrees*mathutils.atan2(dx, dy);          double firstsolution = math.todegrees(math.atan2(dx,dy));          front = secondsolution;         gdx.app.log("","" + firstsolution+ "  " + secondsolution);         return  true;     } 

and jar file here

what problem here?

in place of camera.settoortho(true, 800, 480); use camera.settoortho(false, 800, 480);


Comments