remove redundant code

This commit is contained in:
James 2024-04-20 16:57:59 +01:00
parent 953736e7bc
commit d98d9ece8b
3 changed files with 3 additions and 17 deletions

View file

@ -9,26 +9,18 @@ import java.util.Random;
public class Die extends Actor {
private final Rectangle shape;
/*
0
1 2 3 4
5
*/
private final Face[] faces = new Face[6];
private int faceIndex = 3;
private boolean locked = false;
private final Random random = new Random(); //TODO use central random
public Die() {
int[] pips = {4, 6, 5, 1, 2, 3};
for (int i = 0; i < faces.length; i++) {
faces[i] = new Face(pips[i]);
}
shape = new Rectangle();
}
public Die(float x, float y, float width, float height) {
int[] pips = {4, 6, 5, 1, 2, 3};
for (int i = 0; i < faces.length; i++) {

View file

@ -1,7 +1,7 @@
package com.monjaro.gamejam;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
@ -10,10 +10,9 @@ import java.util.Collections;
import java.util.List;
import java.util.Random;
public class Face extends Actor{
private Rectangle shape = new Rectangle();
private final Rectangle shape = new Rectangle();
private final List<Pip> pips = new ArrayList<>();

View file

@ -3,9 +3,7 @@ package com.monjaro.gamejam;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils;
@ -21,7 +19,6 @@ public class Game extends ApplicationAdapter {
private final List<Die> dice = new ArrayList<>();
private SpriteBatch batch;
private BitmapFont font;
private Texture img;
private final static int TICKS_PER_SECOND = 60;
@ -30,7 +27,6 @@ public class Game extends ApplicationAdapter {
@Override
public void create() {
batch = new SpriteBatch();
font = new BitmapFont();
img = new Texture("badlogic.jpg");
Face.setBlankFaceSprite(new Texture("blank_die_face.png"));
@ -78,7 +74,6 @@ public class Game extends ApplicationAdapter {
actors.forEach(a -> a.render(batch));
//TODO debug
int x = 100;
for (Die die : dice) {
die.render(batch);
}