maintenant les joueurs ont une texture

This commit is contained in:
Damien 2021-05-12 14:08:43 +02:00
parent d00d4f1619
commit 9f2b058311
2 changed files with 12 additions and 1 deletions

View file

@ -11,7 +11,7 @@ public class Planet extends EntityCircle {
// ---------- ATTRIBUTEs ---------- // ---------- ATTRIBUTEs ----------
float revolutionRate = MathUtils.randomTriangular(1) + 1; float revolutionRate = MathUtils.randomTriangular(1) + 1;
Texture texture; private Texture texture;
// ---------- CONSTRUCTORs ---------- // ---------- CONSTRUCTORs ----------

View file

@ -3,6 +3,8 @@ package sagittarius.model;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.MathUtils;
@ -12,6 +14,7 @@ public class Player extends EntityQuad {
private Planet home; private Planet home;
private boolean active; private boolean active;
private Texture texture;
// ---------- CONSTRUCTORs ---------- // ---------- CONSTRUCTORs ----------
@ -23,6 +26,8 @@ public class Player extends EntityQuad {
this.setOrigin(getWidth()/2, getHeight()/2); this.setOrigin(getWidth()/2, getHeight()/2);
this.home = home; this.home = home;
this.texture = new Texture("core/assets/arrow2.png");
} }
// ---------- METHODs ---------- // ---------- METHODs ----------
@ -34,6 +39,12 @@ public class Player extends EntityQuad {
shapes.line(home.getX(), home.getY(), getX(), getY()); shapes.line(home.getX(), home.getY(), getX(), getY());
} }
@Override
public void draw (Batch batch, float parentAlpha) {
batch.draw(texture, getPosition().x - getWidth()/2, getPosition().y - getHeight()/2, this.getWidth()/2, this.getHeight()/2, getWidth(), getHeight(),
1, 1, getRotation(), 0, 0, texture.getWidth(), texture.getHeight(), false, false);
}
@Override @Override
public void act(float dt) { public void act(float dt) {
super.act(dt); super.act(dt);