fix selected dice

This commit is contained in:
James 2024-04-21 01:51:12 +01:00
parent aef7e2c955
commit 4bc740986e
2 changed files with 3 additions and 9 deletions

View file

@ -60,11 +60,6 @@ public class Game extends ApplicationAdapter {
if (input.isKeyJustPressed(Input.Keys.R)) { //reroll dice that aren't locked
dice.stream().filter(d -> !d.isSelected()).forEach(Die::roll);
System.out.println("=".repeat(100));
for (Segment segment : segments) {
System.out.println(segment.getName() + ": " + segment.isDestroyedBy(dice));
}
}
for (int i = 0; i < dice.size(); i++) { //lock dice, iterating over for each keycode
@ -93,13 +88,13 @@ public class Game extends ApplicationAdapter {
die.render(batch);
}
int x = 50;
int y = Gdx.graphics.getHeight() - 50;
for (Segment segment : segments) {
String prefix = "[#9E65A8]";
if (segment.isDestroyed()) prefix = "[#EBE5EC]";
else if (segment.isDestroyedBy(getSelectedDice())) prefix = "[#528154]";
font.draw(batch, prefix + segment.getName(), x += 75, Gdx.graphics.getHeight() - 100);
font.draw(batch, prefix + segment.getName(), 100, y -= 20);
}
//-----
@ -114,7 +109,7 @@ public class Game extends ApplicationAdapter {
public List<Die> getSelectedDice() {
return dice.stream()
.filter(d -> !d.isSelected())
.filter(Die::isSelected)
.toList();
}

View file

@ -4,7 +4,6 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class UI extends Actor{
private Transform position;
private Texture
public void setPosition(int x, int y){
position.x = x;