From 58eb1f71362ee1613a9f6795831b20c09939d794 Mon Sep 17 00:00:00 2001 From: Damien Date: Fri, 14 May 2021 10:33:03 +0200 Subject: [PATCH] ajout des textures d'annimation --- core/assets/{arrow0.png => arrow0-0.png} | Bin core/assets/arrow0-1.png | Bin 0 -> 792 bytes core/assets/arrow0-2.png | Bin 0 -> 786 bytes core/assets/arrow0-3.png | Bin 0 -> 777 bytes core/assets/{arrow1.png => arrow1-0.png} | Bin core/assets/{arrow2.png => arrow2-0.png} | Bin core/src/sagittarius/model/Arrow.java | 50 +++++++++++++++-------- 7 files changed, 32 insertions(+), 18 deletions(-) rename core/assets/{arrow0.png => arrow0-0.png} (100%) create mode 100644 core/assets/arrow0-1.png create mode 100644 core/assets/arrow0-2.png create mode 100644 core/assets/arrow0-3.png rename core/assets/{arrow1.png => arrow1-0.png} (100%) rename core/assets/{arrow2.png => arrow2-0.png} (100%) diff --git a/core/assets/arrow0.png b/core/assets/arrow0-0.png similarity index 100% rename from core/assets/arrow0.png rename to core/assets/arrow0-0.png diff --git a/core/assets/arrow0-1.png b/core/assets/arrow0-1.png new file mode 100644 index 0000000000000000000000000000000000000000..c3efdde6799aecc72e1e4b9f46b736e9f5978445 GIT binary patch literal 792 zcmV+z1LypSP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ940|@HTwGQP|pMGnvY4-1T)@ARt3(k`(_lLR&m+=Mm9oR7A zmHO*tl0_fh;b+`}$JFsRm~aI6d9aXEg&{rC|VGYVy5U3g6aMeHD4!)ZxJl~ok+ z#M)7KuK__J3kltL5Zh5xc!DC%5TghxKv2X+!e(5AD{&d#q=+73Fu?@~invPHgZcj- zpokUL_9kQ(FD6?If+Q+@CTaoB$80V1P~1Ihdl5SVn)BOu1HY)xSZdLmq<}IcS7F@6)0m(4 z4vXFt^2rNe%|F5vXx_C8wk93Uy~K0a!szI6J&r8T?>Ul-m?AQ4>lN`K$u%W4aO(wx z_vuxYEKenwiYOlGbR$Dwt;e52L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d00001 diff --git a/core/assets/arrow0-3.png b/core/assets/arrow0-3.png new file mode 100644 index 0000000000000000000000000000000000000000..726a4646476ed2cccf563be901df8a83a7103840 GIT binary patch literal 777 zcmV+k1NQuhP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ940-i}kK~z{r&6iDx zO<@?v-;3*`lu2pIS0)pi8D&OH%Em`gQ)HB|5m6{*qltwqY$&%ZiJgxWE5!mE--KdC zBa$W-im3T8bFbh3oaf$qu8-zC=UDjFujf7Q+ zQ@~bSf&Dm$YC#JtL&%Qj7%Ft(2u`+G#0o_;5i{Z4gt`aJjfY_(R!_rxi*CFH?8hzm z0+VNdo<%pV0%(K!ejTsiSIrr%7TrVzR3N%a$4xwn$-Z}3bW=zsFMtjI3L8$n*J;rA zg6PBJIExk1E&7jC^Zc44y6_f}#ExMJ?^1wT(*PgcO!ydI)v4yGB~uZly`5ob;G4~) zr%;?4iZj~7aQ_3FsnfQ6edykG!mc7-VtYJH?17VeIuxTxFO|{3P#Mv^>37QIQ5)5$ zC9k0Zs@RkZ+EBtCyKI1uoF0F2BlhS2XcMMME-2s$LEnZ+E|Yw-ja@{0AZ>DEH6Fn) z(N)Ydi*8(ZLjHTbejTdc(==zO4ViEi0H^RGF2dxhy|d`XTfkd<9}mMY4#mTe`6s%! zfQP7G$2#H=8i zTLf*wd#D?Z3g}^F4iPis-2+Qe-+Y}|eeW@fSY~54<1LN}Nwn!U;wQY1Z8mOVbv_U? z;kg5 texture; // ---------- CONSTRUCTORs ---------- @@ -49,24 +51,35 @@ public class Arrow extends EntityQuad { this.landed = false; if (!preview) { - Pixmap pm = new Pixmap(new FileHandle("core/assets/arrow" + MathUtils.random(2) + ".png")); - pm.setBlending(Pixmap.Blending.None); - for (int x = 0; x < pm.getWidth(); x++) { - for (int y = 0; y < pm.getHeight(); y++) { - - Color pc = new Color(); - Color.rgba8888ToColor(pc, pm.getPixel(x, y)); - - if (pc.r == 1 && pc.g == 1 && pc.b == 1) { - pc.r = getColor().r; - pc.g = getColor().g; - pc.b = getColor().b; + texture = new ArrayList<>(); + String path = "core/assets/arrow" + MathUtils.random(0); + + int i = 0; + while (true) { + try { + Pixmap pm = new Pixmap(new FileHandle(path + "-" + i + ".png")); + pm.setBlending(Pixmap.Blending.None); + for (int x = 0; x < pm.getWidth(); x++) { + for (int y = 0; y < pm.getHeight(); y++) { + + Color pc = new Color(); + Color.rgba8888ToColor(pc, pm.getPixel(x, y)); + + if (pc.r == 1 && pc.g == 1 && pc.b == 1) { + pc.r = getColor().r; + pc.g = getColor().g; + pc.b = getColor().b; + } + + pm.drawPixel(x, y, Color.rgba8888(pc)); + } } - - pm.drawPixel(x, y, Color.rgba8888(pc)); + texture.add(new Texture(pm)); + i++; + } catch (com.badlogic.gdx.utils.GdxRuntimeException e) { + break; } } - texture = new Texture(pm); } } @@ -108,8 +121,9 @@ public class Arrow extends EntityQuad { @Override public void draw(Batch batch, float parentAlpha) { - batch.draw(texture, getPosition().x - getOriginX(), getPosition().y - getWidth()/2, getOriginX(), getWidth()/2, getWidth(), getWidth(), - 1, 1, getRotation(), 0, 0, texture.getWidth(), texture.getHeight(), false, false); + int i = (int) (TTL * 3) % 4; + batch.draw(texture.get(i), getPosition().x - getOriginX(), getPosition().y - getWidth()/2, getOriginX(), getWidth()/2, getWidth(), getWidth(), + 1, 1, getRotation(), 0, 0, texture.get(i).getWidth(), texture.get(i).getHeight(), false, false); super.draw(batch, parentAlpha); }