fix: used MathUtils's random
This commit is contained in:
parent
d664987ff8
commit
b327e748aa
BIN
core/assets/arrow0.png
Normal file
BIN
core/assets/arrow0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 9.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.3 KiB |
|
@ -1,9 +1,5 @@
|
|||
package sagittarius.model;
|
||||
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
|
@ -11,6 +7,7 @@ import com.badlogic.gdx.graphics.Texture;
|
|||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.math.Intersector;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
|
||||
|
@ -52,8 +49,7 @@ public class Arrow extends EntityQuad {
|
|||
this.landed = false;
|
||||
|
||||
if (!preview) {
|
||||
Random random = new Random();
|
||||
Pixmap pm = new Pixmap(new FileHandle("core/assets/arrow" + (random.nextInt(2) + 1) + ".png"));
|
||||
Pixmap pm = new Pixmap(new FileHandle("core/assets/arrow" + MathUtils.random(1) + ".png"));
|
||||
pm.setBlending(Pixmap.Blending.None);
|
||||
for (int x = 0; x < pm.getWidth(); x++) {
|
||||
for (int y = 0; y < pm.getHeight(); y++) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package sagittarius.model;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
|
@ -22,8 +20,7 @@ public class Planet extends EntityCircle {
|
|||
public Planet(Vector2 position, float mass, float radius, Color color) {
|
||||
super(0, mass, color, position, radius);
|
||||
|
||||
Random random = new Random();
|
||||
Pixmap pm = new Pixmap(new FileHandle("core/assets/planet" + random.nextInt(5) + ".png"));
|
||||
Pixmap pm = new Pixmap(new FileHandle("core/assets/planet" + MathUtils.random(4) + ".png"));
|
||||
|
||||
pm.setBlending(Pixmap.Blending.None);
|
||||
for (int x = 0; x < pm.getWidth(); x++) {
|
||||
|
|
Loading…
Reference in a new issue