tout le monde a une texture maintenant il faut que ca soit un peu plus joli

This commit is contained in:
Damien 2021-05-12 14:34:07 +02:00
parent ffd7957afb
commit 7c6132426f
3 changed files with 12 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -2,6 +2,8 @@ package sagittarius.model;
import java.util.ArrayList; import java.util.ArrayList;
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.Intersector; import com.badlogic.gdx.math.Intersector;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
@ -24,6 +26,8 @@ public class Arrow extends EntityQuad {
private Planet crash; private Planet crash;
private Vector2 offset; private Vector2 offset;
private Texture texture;
// ---------- CONSTRUCTORs ---------- // ---------- CONSTRUCTORs ----------
/** /**
@ -41,6 +45,8 @@ public class Arrow extends EntityQuad {
this.setSize(100, 4); this.setSize(100, 4);
this.force = computeForce(); this.force = computeForce();
this.landed = false; this.landed = false;
this.texture = new Texture("core/assets/arrow1.png");
} }
// ---------- METHODs ---------- // ---------- METHODs ----------
@ -76,6 +82,12 @@ public class Arrow extends EntityQuad {
} }
} }
@Override
public void draw (Batch batch, float parentAlpha) {
batch.draw(texture, getPosition().x - 0.8f * getWidth(), getPosition().y - getHeight()/2 - 10, 0.8f * this.getWidth(), this.getHeight()/2 + 10, getWidth(), 20 + getHeight(),
1, 1, getRotation(), 0, 0, texture.getWidth(), texture.getHeight(), false, false);
}
/** /**
* Computes the {@link Arrow#force} exerted on the Arrow, * Computes the {@link Arrow#force} exerted on the Arrow,
* according to the other weighted entities. * according to the other weighted entities.