merge
This commit is contained in:
parent
89c691beca
commit
4dbd9699c8
5 changed files with 66 additions and 16 deletions
|
@ -20,7 +20,7 @@ public class Player extends PhysicalEntity {
|
|||
|
||||
public Player(float x, float y){
|
||||
super(x, y, 100, 0, 0, 10);
|
||||
this.tile = new PlayerTile("res/textures/default.png", -250, 0);
|
||||
this.tile = new PlayerTile("res/textures/perso.png", x, y);
|
||||
|
||||
this.longueurBalai = 100;
|
||||
this.brosse = new PhysicalEntity(x, y + this.longueurBalai, 20, 0, 0, 0);
|
||||
|
@ -30,6 +30,14 @@ public class Player extends PhysicalEntity {
|
|||
return this.tile;
|
||||
}
|
||||
|
||||
public void move(float x, float y){
|
||||
this.addPosition(x, y);
|
||||
this.tile.setPosition(new Vector2f(this.x, this.y));
|
||||
this.tile.applyTransform();
|
||||
|
||||
this.brosse.addPosition(x, y);
|
||||
}
|
||||
|
||||
public void rotate(float angleRotation){
|
||||
this.angle += angleRotation;
|
||||
this.angle %= 360;
|
||||
|
@ -38,6 +46,7 @@ public class Player extends PhysicalEntity {
|
|||
}
|
||||
|
||||
this.tile.setRotation(this.angle);
|
||||
this.tile.applyTransform();
|
||||
|
||||
float angleRad = (float)(this.angle * (Math.PI / 180));
|
||||
|
||||
|
@ -51,6 +60,11 @@ public class Player extends PhysicalEntity {
|
|||
return this.brosse.collideWithSquareHitBox(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return this.brosse.toString();
|
||||
}
|
||||
|
||||
private class PlayerTile extends Tile {
|
||||
|
||||
public PlayerTile(String texturePath, float x, float y){
|
||||
|
@ -58,16 +72,11 @@ public class Player extends PhysicalEntity {
|
|||
|
||||
this.setTexture(Texture.loadTexture(texturePath));
|
||||
|
||||
this.setPosition(x, y);
|
||||
this.setPosition(new Vector2f(x, y));
|
||||
|
||||
this.setScale(new Vector2f(50, 50));
|
||||
this.setScale(new Vector2f(this.getTexture().width, this.getTexture().height));
|
||||
|
||||
this.applyTransform();
|
||||
}
|
||||
|
||||
public void setPosition(float x, float y){
|
||||
this.setPosition(new Vector2f(x, y));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue