annimation du ptit bonhomme
This commit is contained in:
parent
08d0802731
commit
b959cc3fa7
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.2 KiB |
|
@ -19,6 +19,7 @@ public class Player extends EntityQuad {
|
||||||
private Planet home;
|
private Planet home;
|
||||||
private boolean active;
|
private boolean active;
|
||||||
private ArrayList<Texture> texture;
|
private ArrayList<Texture> texture;
|
||||||
|
private int T = 0;
|
||||||
|
|
||||||
// ---------- CONSTRUCTORs ----------
|
// ---------- CONSTRUCTORs ----------
|
||||||
|
|
||||||
|
@ -73,8 +74,12 @@ public class Player extends EntityQuad {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Batch batch, float parentAlpha) {
|
public void draw(Batch batch, float parentAlpha) {
|
||||||
batch.draw(texture.get(0), getPosition().x - getWidth()/2, getPosition().y - getHeight()/2, getWidth()/2, getHeight()/2, getWidth(), getHeight(),
|
T++;
|
||||||
1, 1, getRotation(), 0, 0, texture.get(0).getWidth(), texture.get(0).getHeight(), false, false);
|
T %= 100;
|
||||||
|
int i = (int) (T * ((float) texture.size() / 100));
|
||||||
|
System.out.println(i);
|
||||||
|
batch.draw(texture.get(i), getPosition().x - getWidth()/2, getPosition().y - getHeight()/2, getWidth()/2, getHeight()/2, getWidth(), getHeight(),
|
||||||
|
1, 1, getRotation(), 0, 0, texture.get(i).getWidth(), texture.get(i).getHeight(), false, false);
|
||||||
super.draw(batch, parentAlpha);
|
super.draw(batch, parentAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue