remove redundant code
This commit is contained in:
parent
953736e7bc
commit
d98d9ece8b
3 changed files with 3 additions and 17 deletions
|
@ -9,26 +9,18 @@ import java.util.Random;
|
||||||
public class Die extends Actor {
|
public class Die extends Actor {
|
||||||
|
|
||||||
private final Rectangle shape;
|
private final Rectangle shape;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
0
|
0
|
||||||
1 2 3 4
|
1 2 3 4
|
||||||
5
|
5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private final Face[] faces = new Face[6];
|
private final Face[] faces = new Face[6];
|
||||||
private int faceIndex = 3;
|
private int faceIndex = 3;
|
||||||
private boolean locked = false;
|
private boolean locked = false;
|
||||||
|
|
||||||
private final Random random = new Random(); //TODO use central random
|
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) {
|
public Die(float x, float y, float width, float height) {
|
||||||
int[] pips = {4, 6, 5, 1, 2, 3};
|
int[] pips = {4, 6, 5, 1, 2, 3};
|
||||||
for (int i = 0; i < faces.length; i++) {
|
for (int i = 0; i < faces.length; i++) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.monjaro.gamejam;
|
package com.monjaro.gamejam;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
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.Rectangle;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
|
|
||||||
|
@ -10,10 +10,9 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
|
||||||
public class Face extends Actor{
|
public class Face extends Actor{
|
||||||
|
|
||||||
private Rectangle shape = new Rectangle();
|
private final Rectangle shape = new Rectangle();
|
||||||
|
|
||||||
private final List<Pip> pips = new ArrayList<>();
|
private final List<Pip> pips = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,7 @@ package com.monjaro.gamejam;
|
||||||
import com.badlogic.gdx.ApplicationAdapter;
|
import com.badlogic.gdx.ApplicationAdapter;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Input;
|
import com.badlogic.gdx.Input;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
import com.badlogic.gdx.utils.ScreenUtils;
|
import com.badlogic.gdx.utils.ScreenUtils;
|
||||||
|
|
||||||
|
@ -21,7 +19,6 @@ public class Game extends ApplicationAdapter {
|
||||||
private final List<Die> dice = new ArrayList<>();
|
private final List<Die> dice = new ArrayList<>();
|
||||||
|
|
||||||
private SpriteBatch batch;
|
private SpriteBatch batch;
|
||||||
private BitmapFont font;
|
|
||||||
private Texture img;
|
private Texture img;
|
||||||
|
|
||||||
private final static int TICKS_PER_SECOND = 60;
|
private final static int TICKS_PER_SECOND = 60;
|
||||||
|
@ -30,7 +27,6 @@ public class Game extends ApplicationAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
batch = new SpriteBatch();
|
batch = new SpriteBatch();
|
||||||
font = new BitmapFont();
|
|
||||||
img = new Texture("badlogic.jpg");
|
img = new Texture("badlogic.jpg");
|
||||||
|
|
||||||
Face.setBlankFaceSprite(new Texture("blank_die_face.png"));
|
Face.setBlankFaceSprite(new Texture("blank_die_face.png"));
|
||||||
|
@ -78,7 +74,6 @@ public class Game extends ApplicationAdapter {
|
||||||
actors.forEach(a -> a.render(batch));
|
actors.forEach(a -> a.render(batch));
|
||||||
|
|
||||||
//TODO debug
|
//TODO debug
|
||||||
int x = 100;
|
|
||||||
for (Die die : dice) {
|
for (Die die : dice) {
|
||||||
die.render(batch);
|
die.render(batch);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue