From 61924b85b6572877cc03d8c4b60c14d01d8a7c25 Mon Sep 17 00:00:00 2001 From: Damien Date: Wed, 12 May 2021 19:35:34 +0200 Subject: [PATCH] le code est jste plus beau --- core/src/sagittarius/model/Arrow.java | 5 +---- core/src/sagittarius/model/Planet.java | 7 +------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/core/src/sagittarius/model/Arrow.java b/core/src/sagittarius/model/Arrow.java index 1a3d669..ed7f818 100644 --- a/core/src/sagittarius/model/Arrow.java +++ b/core/src/sagittarius/model/Arrow.java @@ -51,10 +51,7 @@ public class Arrow extends EntityQuad { this.landed = false; Random random = new Random(); - Pixmap pm = new Pixmap(new FileHandle(new String[] { - "core/assets/arrow1.png", - "core/assets/arrow2.png" - }[random.nextInt(2)])); + Pixmap pm = new Pixmap(new FileHandle("core/assets/arrow" + (random.nextInt(2) + 1) + ".png")); pm.setBlending(Pixmap.Blending.None); for (int x = 0; x < pm.getWidth(); x++) { diff --git a/core/src/sagittarius/model/Planet.java b/core/src/sagittarius/model/Planet.java index 62da752..1883f3e 100644 --- a/core/src/sagittarius/model/Planet.java +++ b/core/src/sagittarius/model/Planet.java @@ -23,12 +23,7 @@ public class Planet extends EntityCircle { super(0, mass, color, position, radius); Random random = new Random(); - Pixmap pm = new Pixmap(new FileHandle(new String[] { - "core/assets/planet1.png", - "core/assets/planet2.png", - "core/assets/planet3.png", - "core/assets/planet4.png" - }[random.nextInt(4)])); + Pixmap pm = new Pixmap(new FileHandle("core/assets/planet" + random.nextInt(5) + ".png")); pm.setBlending(Pixmap.Blending.None); for (int x = 0; x < pm.getWidth(); x++) {