fix: correction bogue lors de rotation des transmuteurs.
This commit is contained in:
parent
ea15e1e37c
commit
90609b9597
|
@ -84,12 +84,12 @@ public class Transhower extends Actor {
|
||||||
float change=0;
|
float change=0;
|
||||||
boolean dir=false;
|
boolean dir=false;
|
||||||
if (keepaspectratio) {
|
if (keepaspectratio) {
|
||||||
change=Math.abs(deltax-deltay);
|
change=deltax-deltay;
|
||||||
if (change<0) {
|
if (change>0) {
|
||||||
deltay=deltax;
|
deltay=deltax;
|
||||||
dir=true;
|
dir=true;
|
||||||
}
|
}
|
||||||
else if (change>0) {
|
else if (change<0) {
|
||||||
deltax=deltay;
|
deltax=deltay;
|
||||||
dir=false;
|
dir=false;
|
||||||
}
|
}
|
||||||
|
@ -105,12 +105,12 @@ public class Transhower extends Actor {
|
||||||
float sizey=AssetLoader.height/(this.getHeight()/deltay);
|
float sizey=AssetLoader.height/(this.getHeight()/deltay);
|
||||||
float decx = -this.getX()/AssetLoader.width*sizex;
|
float decx = -this.getX()/AssetLoader.width*sizex;
|
||||||
float decy = -this.getY()/AssetLoader.height*sizey;
|
float decy = -this.getY()/AssetLoader.height*sizey;
|
||||||
if (change!=0)
|
if (keepaspectratio && change!=0)
|
||||||
if (dir)
|
if (dir)
|
||||||
decy=decy-change/2;
|
decy=decy-Math.abs(change/2);
|
||||||
else
|
else
|
||||||
decx=decx-change/2;
|
decx=decx-Math.abs(change/2);
|
||||||
Gdx.app.debug("wirechem-Transhower", "Camera dec:"+decx+","+decy+" view:"+sizex+","+sizey+" change:"+change+","+dir);
|
Gdx.app.debug("wirechem-Transhower", "Camera delta:"+deltax+","+deltay+" dec:"+decx+","+decy+" view:"+sizex+","+sizey+" change:"+change+","+dir);
|
||||||
camera.setToOrtho(false, sizex, sizey);
|
camera.setToOrtho(false, sizex, sizey);
|
||||||
camera.translate(decx,decy);
|
camera.translate(decx,decy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,7 +271,7 @@ public class LevelScreen implements Screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
public LevelScreen(Worlds aworlds) {
|
public LevelScreen(Worlds aworlds) {
|
||||||
test=new Transhower(AssetLoader.getTransmuter("<>"),Transmuter.Angular.A90,true, new Color(0,1f,0f,1f));
|
test=new Transhower(AssetLoader.getTransmuter("--"),Transmuter.Angular.A270,true, new Color(0,1f,0f,1f));
|
||||||
test.setPosition(1920/2, 70);
|
test.setPosition(1920/2, 70);
|
||||||
test.setWidth(512);
|
test.setWidth(512);
|
||||||
test.setHeight(512);
|
test.setHeight(512);
|
||||||
|
|
Loading…
Reference in New Issue