fix: correction bogue viewport sur lasers
This commit is contained in:
parent
0450d23b28
commit
57c8c042a6
@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.GL20;
|
|||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.Texture.TextureFilter;
|
import com.badlogic.gdx.graphics.Texture.TextureFilter;
|
||||||
import com.badlogic.gdx.graphics.Texture.TextureWrap;
|
import com.badlogic.gdx.graphics.Texture.TextureWrap;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
@ -29,11 +30,10 @@ public class Laser {
|
|||||||
overlay=AssetLoader.Skin_level.getAtlas().findRegion("overlay");
|
overlay=AssetLoader.Skin_level.getAtlas().findRegion("overlay");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(float x1,float y1,float x2,float y2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) {
|
public void draw(Batch Laser,float x1,float y1,float x2,float y2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) {
|
||||||
Vector2 vectorall = new Vector2(x2, y2).sub(new Vector2(x1, y1));
|
Vector2 vectorall = new Vector2(x2, y2).sub(new Vector2(x1, y1));
|
||||||
float length = vectorall.len();
|
float length = vectorall.len();
|
||||||
Vector2 vectoradd = vectorall.scl(10/length);
|
Vector2 vectoradd = vectorall.scl(10/length);
|
||||||
SpriteBatch Laser=new SpriteBatch();
|
|
||||||
Laser.begin();
|
Laser.begin();
|
||||||
Laser.setColor(colorsrc);
|
Laser.setColor(colorsrc);
|
||||||
Laser.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE);
|
Laser.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE);
|
||||||
@ -43,7 +43,6 @@ public class Laser {
|
|||||||
Laser.draw(overlay,x1+i*vectoradd.x,y1+i*vectoradd.y,32,0,64,Calcul.getLen(x1+i*vectoradd.x,y1+i*vectoradd.y,x2,y2),1f,1f,(float)Math.toDegrees(Calcul.getAngle(x1,y1,x2,y2)));
|
Laser.draw(overlay,x1+i*vectoradd.x,y1+i*vectoradd.y,32,0,64,Calcul.getLen(x1+i*vectoradd.x,y1+i*vectoradd.y,x2,y2),1f,1f,(float)Math.toDegrees(Calcul.getAngle(x1,y1,x2,y2)));
|
||||||
Laser.draw(overlay,x1,y1,32,0,64,Calcul.getLen(x1+i*vectoradd.x,y1+i*vectoradd.y,x2,y2),1f,1f,(float)Math.toDegrees(Calcul.getAngle(x1,y1,x2,y2)));
|
Laser.draw(overlay,x1,y1,32,0,64,Calcul.getLen(x1+i*vectoradd.x,y1+i*vectoradd.y,x2,y2),1f,1f,(float)Math.toDegrees(Calcul.getAngle(x1,y1,x2,y2)));
|
||||||
Laser.end();
|
Laser.end();
|
||||||
Laser.dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawnotsoold(float x1,float y1,float x2,float y2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) {
|
public void drawnotsoold(float x1,float y1,float x2,float y2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) {
|
||||||
|
@ -105,7 +105,7 @@ public class LevelRenderer {
|
|||||||
}
|
}
|
||||||
if (found!=-1)
|
if (found!=-1)
|
||||||
{
|
{
|
||||||
Laser.draw(LevelScreen.buttonLevels[i].level.X+20,LevelScreen.buttonLevels[i].level.Y+20,LevelScreen.buttonLevels[found].level.X+20,LevelScreen.buttonLevels[found].level.Y+20,10,0.5f,LevelScreen.buttonLevels[found].Activated,LevelScreen.buttonLevels[i].getLevelcolor(),LevelScreen.buttonLevels[found].getLevelcolor());
|
Laser.draw(batcher,LevelScreen.buttonLevels[i].level.X+20,LevelScreen.buttonLevels[i].level.Y+20,LevelScreen.buttonLevels[found].level.X+20,LevelScreen.buttonLevels[found].level.Y+20,10,0.5f,LevelScreen.buttonLevels[found].Activated,LevelScreen.buttonLevels[i].getLevelcolor(),LevelScreen.buttonLevels[found].getLevelcolor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user